Problem with writing a long line in a text file
sjmachin at lexicon.net
Wed Nov 19 23:56:23 CET 2008
On Nov 20, 9:31 am, Joe Strout <j... at strout.net> wrote:
> On Nov 19, 2008, at 3:27 PM, Mohsen Akbari wrote:
> > I'm a newbie in python and I have this problem with the code that
> > I'm writing. There is a very long line which I wish to output it to
> > a text file.But when I do this, in the output file, the result
> > appears in two lines.
> Appears that way where? Using what tool to view it?
> My guess is that there is nothing wrong with the file, but that
> whatever you're using to view it is simply displaying it as two lines
> even though it is actually one.
Or the "line" contains an embedded newline.
The OP may like to insert some debug code just before he writes the
print line.find('\n'), len(line), repr(line)
and tell us how long is "very long".
More information about the Python-list