newbie question

David Palao dpalao.python at gmail.com
Thu Mar 24 06:49:05 EDT 2016


Hi,
Use "eval":
s = "(1, 2, 3, 4)"
t = eval(s)

Best

2016-03-24 11:39 GMT+01:00 ast <nomail at com.invalid>:
> Hi
>
> I have a string which contains a tupe, eg:
>
> s = "(1, 2, 3, 4)"
>
> and I want to recover the tuple in a variable t
>
> t = (1, 2, 3, 4)
>
> how would you do ?
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list