First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered Jun 26 '12

Daniel_Hillier gravatar image

Your list has a tuple as its first element. To grab the tuple, just you need to get the 0-th element from the list:

>>> data = [(‘filename1’,
...         filename2’, 
...          ...)]
>>> filenames = data[0]
>>> print filenames
(‘filename1’,
 filename2’, 
 ...)

As tuples can't be altered once they have been created, if you want to change the data in the tuple, you will need to convert it to a list first:

>>> filenames = list(filenames)
>>> print filenames
[‘filename1’,
 filename2’, 
 ...]