Sorry for not being clearI would have something like this
x = [1, 2, 3,5 ,6 ,9,234]

Then
def savedata(dataname): ..........

savedata(x)

this would save a to a file called x.csv This is my problem, getting the
name to be x.csv which is the same as the name of the list.

and the data in the file would be
1,2,3,5,6,9,234 this parts works

Thanks
Vincent Davis
720-301-3003


On Wed, Feb 4, 2009 at 9:48 AM, Tim Chase <python.l...@tim.thechases.com>wrote:

> 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
>
>
>
>
>
>
>
>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to