Writing to a file

John Gordon gordon at panix.com
Fri Mar 25 12:02:04 EDT 2011


In <mailman.1249.1301065649.1189.python-list at python.org> <jyoung79 at kc.rr.com> writes:

> Just curious how others view the 2 examples below for creating and 
> writing to a file in Python (in OS X).  Is one way better than the other?  
> If it was a large amount of text, would the 'os.system' call be a bad 
> way to do it?

The write() way is much better.  (However, I'm not sure it will do what
you were expecting with the tilde in the file path.)

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list