help

Tim Chase python.list at tim.thechases.com
Thu Jul 19 19:43:31 EDT 2012


On 07/19/12 18:26, Prasad, Ramit wrote:
>> ('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'
> 
> You can use ast.literal_eval if you add an enclosing () or [] in the string 
> (and add a finishing paren for the last tuple).

If you want a resulting tuple-of-tuple and you have at least one
comma after the first tuple, you don't even have to include the ()
around it.

-tkc





More information about the Python-list mailing list