Path: csiph.com!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Matt Wheeler Newsgroups: comp.lang.python Subject: Re: newbie question Date: Thu, 24 Mar 2016 10:57:40 +0000 Lines: 28 Message-ID: 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: 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: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:105599 >>> 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 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