On Jul 19, 2012 4:04 PM, "Miriam Gomez Rios" <miriam.gome...@udlap.mx>
wrote:
>
> Hello, sorry for bothering you, but I have a doubt,
>
> Is there a way to turn this string into a tuplelist??????, I need it for
gurobi
>
>
('per1','persona1.1','pro1'),('per1','persona1.1','pro2'),('per1','persona1.1','pro3'),('per1','persona1.1','pro4'),('per1','persona1.1','pro5'),('per2','persona2.1','pro1'),('per2','persona2.1','pro2'),('per2','persona2.1','pro3'),('per2','persona2.1','pro4'),('per2','persona2.1','pro5'),('per2','persona2.2','pro1'),('per2','persona2.2','pro2'),('per2','persona2.2','pro3'),('per2','persona2.2','pro4'),('per2','persona2.2','pro5'),('per2','persona2.3','pro1'),('per2','persona2.3','pro2'),('per2','persona2.3','pro3'),('per2','persona2.3','pro4'),('per2','persona2.3','pro5'),('per2','persona2.4','pro1'),('per2','persona2.4','pro2'),('per2','persona2.4','pro3'
>
> the string is made with fors, using data from another file, and I need it
as a tuplelist
>
> Thank you
>
>
> --

It looks like you can just put brackets around it and call ast.literal_eval.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to