Newbie question about file input

Aaron Deskins ndeskins at ecn.purdue.edu
Tue Aug 17 11:07:42 EDT 2004


Christopher T King wrote:

> On Tue, 17 Aug 2004, Aaron Deskins wrote:
> 
> 
>>    Also, what exactly is stored when a blank line is read by the
>>readline command? A zero, blank, or what???
> 
> 
> readline() always includes the '\n' that terminates the line, so any 
> 'blank' line that is read will be returned as a simply '\n'.  The only 
> time readline() won't return a line terminated with '\n' is if the last 
> line of the file isn't terminated with '\n' (common on Windows), in which 
> context a blank line is meaningless.
> 
So why does a linesplit fail after the program reads a blank line (or a 
'\n')? Is this simply because there's no way to assign the variable '\n' ?

-- 
Aaron Deskins
Graduate Student
Chemical Engineering
Purdue University



More information about the Python-list mailing list