[Tutor] parsing text

Kent Johnson kent37 at tds.net
Sun Mar 25 04:26:33 CEST 2007


Alan Gauld wrote:

>> 1.) when i do readlines and create a list and then print the list it
>> adds a blank line between every line of text
> 
> I suspect that's because you are reading a newline character
> from the file and print adds a newline of its own. You need to
> use rstrip() to take out the newline from the file.

or use sys.stdout.write() instead of print, it doesn't add a newline.

Kent


More information about the Tutor mailing list