Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #101017

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

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Newbie: How to convert a tuple of strings into a tuple of ints
Date 2015-12-31 09:52 +1100
Message-ID <mailman.89.1451515970.11925.python-list@python.org> (permalink)
References <fcd51ccc-b087-4147-a3e2-276b2f3052f4@googlegroups.com>

Show all headers | View raw


On Thu, Dec 31, 2015 at 9:46 AM,  <otaksoftspamtrap@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Newbie: How to convert a tuple of strings into a tuple of ints otaksoftspamtrap@gmail.com - 2015-12-30 14:46 -0800
  Re: Newbie: How to convert a tuple of strings into a tuple of ints Chris Angelico <rosuav@gmail.com> - 2015-12-31 09:52 +1100
  Re: Newbie: How to convert a tuple of strings into a tuple of ints Ben Finney <ben+python@benfinney.id.au> - 2015-12-31 09:57 +1100
    Re: Newbie: How to convert a tuple of strings into a tuple of ints otaksoftspamtrap@gmail.com - 2015-12-30 15:00 -0800
  Re: Newbie: How to convert a tuple of strings into a tuple of ints Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-30 16:00 -0700

csiph-web