Fwd: Problem with writing a long line in a text file
mohsen.akbari at gmail.com
Thu Nov 20 20:52:52 CET 2008
--- I use notepad to view my txt file. It appears that way in this tool.
--- Here is the output of the debug lines that you mentioned:
---------- Forwarded message ----------
From: Mohsen Akbari <mohsen.akbari at gmail.com>
Date: Nov 19, 2008 5:27 PM
Subject: Problem with writing a long line in a text file
To: python-list at python.org
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. I thought maybe that's because the maximum possible length of the
text file has been reached so I opened the file and I tried to put some
space at the end of the first line. It wasn't possible to do that for the
first line and the space was placed before the first character of the second
line. I kept pressing space bar to add more spaces and so the whole second
line was moved to the write till it exceeded the first line. I mean the
length of the second line became longer than the first line which means the
text file can accept longer lines.
As a second guess, I thought maybe I had '\n' somewhere in my input string
so I tried to check that by doing:
temp_ = out_string.find('\n')
The result was -1 which I think means there is not '\n' in my output
string. Now I'm really confused and I don't know what to do. I really
appreciate it if somebody can help me out.
BTW, I'm using windows.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list