converting lists to strings to lists
robin
robin.meier at gmail.com
Wed Apr 12 10:19:32 EDT 2006
thanks for your answer. split gives me a list of strings, but i found a
way to do what i want:
input='0.1, 0.2, 0.3;\n'
input = list(eval(input[0:-2]))
print input
> [0.10000000000000001, 0.20000000000000001, 0.29999999999999999]
this does fine... but now, how do i convert this list to a string?
my_new_string = ' '.join(input)
gives me:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: sequence item 0: expected string, float found
thanks,
robin
More information about the Python-list
mailing list