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


Groups > comp.lang.python > #100746 > unrolled thread

Newbie: String to Tuple

Started byKP <kai.peters@gmail.com>
First post2015-12-22 12:53 -0800
Last post2015-12-22 22:07 +0100
Articles 4 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Newbie: String to Tuple KP <kai.peters@gmail.com> - 2015-12-22 12:53 -0800
    Re: Newbie: String to Tuple Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-22 20:59 +0000
      Re: Newbie: String to Tuple KP <kai.peters@gmail.com> - 2015-12-22 13:06 -0800
    Re: Newbie: String to Tuple Peter Otten <__peter__@web.de> - 2015-12-22 22:07 +0100

#100746 — Newbie: String to Tuple

FromKP <kai.peters@gmail.com>
Date2015-12-22 12:53 -0800
SubjectNewbie: String to Tuple
Message-ID<56576725-0f10-4c7b-aead-272f2e3a8456@googlegroups.com>
How do I convert

'1280,1024'

to

(1280,1024) ? 

Thanks for all help!

[toc] | [next] | [standalone]


#100747

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-12-22 20:59 +0000
Message-ID<mailman.69.1450817986.2237.python-list@python.org>
In reply to#100746
On 22/12/2015 20:53, KP wrote:
> How do I convert
>
> '1280,1024'
>
> to
>
> (1280,1024) ?
>
> Thanks for all help!
>

Start with this https://docs.python.org/3/library/stdtypes.html#str.split

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#100748

FromKP <kai.peters@gmail.com>
Date2015-12-22 13:06 -0800
Message-ID<e9b7436e-fffd-4923-81f6-bec1536cd9b9@googlegroups.com>
In reply to#100747
On Tuesday, 22 December 2015 12:59:59 UTC-8, Mark Lawrence  wrote:
> On 22/12/2015 20:53, KP wrote:
> > How do I convert
> >
> > '1280,1024'
> >
> > to
> >
> > (1280,1024) ?
> >
> > Thanks for all help!
> >
> 
> Start with this https://docs.python.org/3/library/stdtypes.html#str.split
> 
> -- 
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
> 
> Mark Lawrence

Thanks - just what I was missing!

[toc] | [prev] | [next] | [standalone]


#100749

FromPeter Otten <__peter__@web.de>
Date2015-12-22 22:07 +0100
Message-ID<mailman.70.1450818473.2237.python-list@python.org>
In reply to#100746
KP wrote:

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


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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web