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

Fred nobody at nowhere.com
Wed Jul 21 09:15:10 EDT 2004


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()	

3. Open a DOS box, and type either "test.py" or "python test.py":

"NameError: name 'concat' is not defined"

I tried the following:

- from operator import *  -> "AttributeError: 'str' object has no
attribute 'close'"
- import operator -> "NameError: name 'concat' is not defined"
- file=concat('./test.txt','w')
- file=concat('.\test.txt','w')

... all to no avail. Obviously, I'm either missing a package or I need
to tweak something. Any idea?

Thank you
Fred.



More information about the Python-list mailing list