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


Groups > comp.lang.python > #105599

Re: newbie question

Path csiph.com!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!not-for-mail
From Matt Wheeler <m@funkyhat.org>
Newsgroups comp.lang.python
Subject Re: newbie question
Date Thu, 24 Mar 2016 10:57:40 +0000
Lines 28
Message-ID <mailman.87.1458817089.2244.python-list@python.org> (permalink)
References <56f3c3eb$0$4546$426a74cc@news.free.fr>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de wUi8M/W1M2TuZ7zzdYJf9QBlvaRYDUeZtREFoJKXaX7Q==
Return-Path <m@funkyhat.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'subject:question': 0.08; '(1,': 0.09; 'ast': 0.09; 'tuple': 0.09; '2016': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'to:name:python list': 0.16; 'wrote:': 0.16; 'string': 0.17; 'variable': 0.18; '>>>': 0.20; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'url:mailman': 0.30; 'url:python': 0.33; 'url:listinfo': 0.34; 'received:google.com': 0.35; 'url:org': 0.36; 'received:209.85': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'march': 0.64; 'eg:': 0.84; 'from:addr:m': 0.84; 'recover': 0.91
X-Virus-Scanned Debian amavisd-new at membrane.funkyhat.net
X-Gm-Message-State AD7BkJIO0BetqCg9/acp9JMCVDJPm5QJUhlR6FuLnKf1WXVjKSg99QWMZkwpCgFwhuMCUsLBghzMNN1q5LyGxg==
X-Received by 10.112.221.129 with SMTP id qe1mr198915lbc.118.1458817080459; Thu, 24 Mar 2016 03:58:00 -0700 (PDT)
In-Reply-To <56f3c3eb$0$4546$426a74cc@news.free.fr>
X-Gmail-Original-Message-ID <CAG93HwFywmkHdBMXMKOKCu7S6mHtvjZt5Lenzb8tG-aKigwm=Q@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:105599

Show key headers only | View raw


>>> import ast
>>> s = "(1, 2, 3, 4)"
>>> t = ast.literal_eval(s)
>>> t
(1, 2, 3, 4)

On 24 March 2016 at 10:39, ast <nomail@com.invalid> wrote:
> Hi
>
> I have a string which contains a tupe, eg:
>
> s = "(1, 2, 3, 4)"
>
> and I want to recover the tuple in a variable t
>
> t = (1, 2, 3, 4)
>
> how would you do ?
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Matt Wheeler
http://funkyh.at

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


Thread

newbie question "ast" <nomail@com.invalid> - 2016-03-24 11:39 +0100
  Re: newbie question David Palao <dpalao.python@gmail.com> - 2016-03-24 11:49 +0100
    Re: newbie question "ast" <nomail@com.invalid> - 2016-03-24 11:54 +0100
    Re: newbie question Steven D'Aprano <steve@pearwood.info> - 2016-03-25 00:53 +1100
      Re: newbie question Grant Edwards <invalid@invalid.invalid> - 2016-03-24 15:05 +0000
        Re: newbie question wxjmfauth@gmail.com - 2016-03-24 10:11 -0700
  Re: newbie question Matt Wheeler <m@funkyhat.org> - 2016-03-24 10:57 +0000
  Re: newbie question Tim Chase <python.list@tim.thechases.com> - 2016-03-24 05:58 -0500
  Re: newbie question "Sven R. Kunze" <srkunze@mail.de> - 2016-03-24 12:10 +0100
  Re: newbie question Steven D'Aprano <steve@pearwood.info> - 2016-03-24 22:13 +1100
  Re: newbie question Matt Wheeler <m@funkyhat.org> - 2016-03-24 13:22 +0000
    Re: newbie question "ast" <nomail@com.invalid> - 2016-03-28 17:34 +0200
      Re: newbie question "Sven R. Kunze" <srkunze@mail.de> - 2016-03-29 12:23 +0200
  Re: newbie question "Sven R. Kunze" <srkunze@mail.de> - 2016-03-24 18:47 +0100

csiph-web