[newbie] Writing to file : "name 'concat' is not defined"?

Brian Quinlan brian at sweetapp.com
Wed Jul 21 15:31:00 CEST 2004


Fred wrote:
> Hi,
> 
> 	I've searched the web and the archives of this ng for half an
> hour already, and I'm still stuck.
> 
> 1. On a W2K Pro host, installed the latest ActivePython MSI. Rebooted.
> 2. Create test.py with the following:
> 
> file=concat('test.txt','w')
> file.close()	

Think about these two lines of code for a minute...what do you expect 
"concat" to return? A file object? Maybe this would help:

file = open('test.txt', 'w')
file.close()

Or, even better (since "file" is a builtin object):

f = open('test'.txt', 'w')
f.close()

Cheers,
Brian



More information about the Python-list mailing list