supressing '\n' at the end

Irmen de Jong irmen at
Sat Nov 6 23:10:11 CET 2004

SunX wrote:
> Gurus;
> I need some help here.  How do you supress the newline char. at the
> end of a file.write(str(aString))?  I know you can add a newline by
> simply doing file.write(str(aString) + '\n'), but not
> file.write(str(aString) - '\n').

Where does the \n come from? I presume the 'aString' object contains
it. Then you can do:


(but only if aString always contains a '\n' at the end, ofcourse)


More information about the Python-list mailing list