Reading/writing files
Dennis Reinhardt
DennisR at dair.com
Mon Apr 14 16:27:27 EDT 2003
> input file. That's because print automatically appends a new line
> character to the end of each line it prints, and the file already contains
> new line characters. To get round that, you could import the sys module
> and use sys.stdout.write(line) inplace of the print statement.
> Alternatively you could use the rstrip() method on a string (see below).
Far simpler is a trailing comma: "print line," instead of "print line"
--
Dennis Reinhardt
DennisR at dair.com
http://www.spamai.com
More information about the Python-list
mailing list