[Tutor] Tutor Digest, Vol 32, Issue 49

Alan Gauld alan.gauld at btinternet.com
Fri Oct 13 11:09:04 CEST 2006


"Meher Kolli" <meherkp at gmail.com> wrote in message 

> You can't  add  \n  to  a string ..up have  use something like this
> 
>   if str == 'q':
>       done = 1
>       fd.close()
>   else:
>       fd.write("%s \n" %(str))

What makes you think so?

>>> s = 'l'
>>> s += '\n'
>>> s
'l\n'
>>>

Seems to work.... '\n' is just a character like any other.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list