By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,715 Members | 748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,715 IT Pros & Developers. It's quick & easy.

Re: Problem with writing a long line in a text file

P: n/a
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.

HTH,
- Joe

Nov 19 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Nov 20, 9:31*am, Joe Strout <j...@strout.netwrote:
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
line:
print line.find('\n'), len(line), repr(line)

and tell us how long is "very long".
Nov 19 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.