Hi,

I'm trying to create a new file. In this file I want to add some results I have received from my code. Unfortunately I get a error message saying I can't combine str with list. So then I tried to make a string out of the list and ended up with this

0
0
...etcetc

where the left column is the so called string and the rest is the list I tried to make a string by doing like this: str(mylist). I want to be able to write to a new file both the string and this list I have.

Make a string with ' '.join(thelist) (or '\t'.join(), or 'foo'.join()). The list must contain strings. There are other methods, you can write the list items one by one in the file.

line.split(None, 1) to split it and do eval on secoond item off the result.

>>> line = "0 ['a', 'b', 'c']"
>>> st, seq = line.split(None, 1)
>>> seq = eval(seq)
>>> st, seq
('0', ['a', 'b', 'c'])
>>>