On 12/10/2009 6:12 AM, Luke Paireepinart wrote:
This won't work unless you have STDOUT redirected to your file.  It
would be better just to do
  fobj.write('\n'.join(all) + '\n')

except that if you're joining a very long string, you'll have python copy the whole string again.

better to just redirect print
print >> fobj, '\n'.join(all)

but since this is a file object we're talking about, you can write while getting user input.

with open(...) as fobj:
    entry = ''
    while entry != '.'
        fobj.write(raw_input())

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to