Newbie: String to Tuple

Peter Otten __peter__ at web.de
Tue Dec 22 16:07:41 EST 2015


KP wrote:

> How do I convert
> 
> '1280,1024'
> 
> to
> 
> (1280,1024) ?


>>> import ast
>>> ast.literal_eval('1280,1024')
(1280, 1024)





More information about the Python-list mailing list