Newbie: How to convert a tuple of strings into a tuple of ints

Chris Angelico rosuav at gmail.com
Wed Dec 30 17:52:41 EST 2015


On Thu, Dec 31, 2015 at 9:46 AM,  <otaksoftspamtrap at gmail.com> wrote:
> How do I get from here
>
> t = ('1024', '1280')
>
> to
>
> t = (1024, 1280)
>
>
> Thanks for all help!

t = (int(t[0]), int(t[1]))

If the situation is more general than that, post your actual code and
we can help out more. Working with a single line isn't particularly
easy. :)

ChrisA



More information about the Python-list mailing list