On 12/16/2011 2:49 PM ADRIAN KELLY said...
thanks dave,
just tried writing to file for the first time

def main():
outfile.write('Hello this is a test')
outfile.close()
main()

*error, globalname outfile is not defined, do i need to import function
to get this working?*

No, but you do need to initialize outfile appropriately. The error (next time post the entire traceback please -- it provides the specifics you'll need to fix the bug) tells you that 'outfile is not defined'

If you set outfile to a writable file object you'll get it going. Look at the 'open' documentation.

HTH,

Emile


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

Reply via email to