Use list name as string
Tim Chase
python.list at tim.thechases.com
Wed Feb 4 11:48:16 EST 2009
> I know this is wrong it uses the items in the list as the filename,
> how do I refer to the dataname and not the items in it.
Without a sample value for "dataname", it's hard to tell what
you're trying to do. Do you mean
dataname = ['path', 'to', 'file']
...
filename = os.sep.join(dataname)
Or you have a list of one value, and just want its first item?
filename = dataname[0]
> def savedata(dataname):
> filename = str(dataname) # this does not do what I would like it to
It would help if you detailed what you *would* like it to do...
>>> from MindReading import answer
Traceback (most recent call last):
File "<stdin>", line 6, in comp.lang.python
ImportError: No module named MindReading
Similar failure attempting
>>> import dwim
-tkc
More information about the Python-list
mailing list