write()

The file method that writes a string to a file, adding nothing extra, not even a newline.

In more detail

Write "\n" yourself at the end of each line. write accepts only strings in text mode, so convert numbers with str() or use an f-string. print(..., file=f) is an alternative that adds the newline.

Related terms

Taught in

References