[Tutor] How to write strings with new line character in a file

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri Oct 13 03:32:10 CEST 2006

> while not done:
>    str = raw_input("Enter login name:\t to quit type 'q': ")
>    if str == 'q':
>       done = 1
>    else:
>       str = str + '\n'
>       fd.write(str)

Hi Asrarahmed,

What's 'fd'?  Where is it defined?

(I have a guess, but I'd rather that you show where fd is being defined 

If you're still trying to drive DOS applications with popen(), I'd 
strongly encourage you to take a closer look at PExpect: you should be 
able to get it to work with a Cygwin-based environment.


Good luck!

More information about the Tutor mailing list