Writing lines longer than 80 charc !

Gordon McMillan gmcm at hypernet.com
Tue Apr 6 22:51:56 EDT 1999


Sunit asks:

> I'm wondering if someone knew of a way of writing a line of more
> than 80 characters to a file in way that it won't split it into two
> lines.

That's an artifact of the way you're viewing it. None of the ways of 
writing characters to a file do anything special at 80 characters.

>>> open('test.txt','w').write('a'*1024)
>>> txt = open('test.txt', 'r').read()
>>> len(txt)
1024
>>> txt == 'a'*1024
1

See? Nothing but 'a's.

- Gordon




More information about the Python-list mailing list