how to "normalize" indentation sources

John Machin sjmachin at lexicon.net
Thu May 25 22:00:07 CEST 2006


On 26/05/2006 2:38 AM, John Salerno wrote:
[snip]
> 
> So the line below the last line of the file isn't actually considered an 
> empty line, even though you can move the cursor to it in a text editor?

That line doesn't exist in a file *until* you (a) type something into 
the editor and (b) save the revised contents back to disk.

> 
> If you have a file that has one line and it ends with a newline, at 
> least in my text editor the cursor then moves down to the next line, but 
> is this just a detail of the way the editor itself works, and nothing to 
> do with the file? (i.e., there is really only one line in the file, not 
> two?)

Please consider, if the answer to your question were "no", how could 
anyone add lines to a file using such an editor.
Why you don't fire up your Python and try something for yourself, like:
print repr(open("my_one_line_file.txt".read()))
?



More information about the Python-list mailing list