Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #105600
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: newbie question |
| Date | Thu, 24 Mar 2016 05:58:36 -0500 |
| Lines | 23 |
| Message-ID | <mailman.88.1458817732.2244.python-list@python.org> (permalink) |
| References | <56f3c3eb$0$4546$426a74cc@news.free.fr> <CAKUKWznbxpONGMKpaUerFby9Y9W=357EDZcNhSL3gxbZSRQTEw@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de HCkiXyqNbu4xUGQ6Q0CvYAOXCwo3RmBLroT6ty16tkqQ== |
| Return-Path | <python.list@tim.thechases.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:question': 0.08; 'cc:addr:python-list': 0.09; '(1,': 0.09; 'ast': 0.09; 'tuple': 0.09; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'instead:': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'variable': 0.18; 'cc:addr:python.org': 0.20; 'cc:2**1': 0.22; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'subject:: ': 0.37; 'received:10': 0.37; 'charset:us-ascii': 0.37; 'safety': 0.66; 'received:23': 0.84; 'recover': 0.91 |
| X-Sender-Id | wwwh|x-authuser|tim@thechases.com |
| X-Sender-Id | wwwh|x-authuser|tim@thechases.com |
| X-MC-Relay | Neutral |
| X-MailChannels-SenderId | wwwh|x-authuser|tim@thechases.com |
| X-MailChannels-Auth-Id | wwwh |
| X-MC-Loop-Signature | 1458817310751:1604879693 |
| X-MC-Ingress-Time | 1458817310750 |
| In-Reply-To | <CAKUKWznbxpONGMKpaUerFby9Y9W=357EDZcNhSL3gxbZSRQTEw@mail.gmail.com> |
| X-Mailer | Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) |
| X-AuthUser | tim@thechases.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:105600 |
Show key headers only | View raw
On 2016-03-24 11:49, David Palao wrote: >> 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 ? > > Use "eval": > s = "(1, 2, 3, 4)" > t = eval(s) Using eval() has security implications. Use ast.literal_eval for safety instead: import ast s = "(1, 2, 3, 4)" t = ast.literal_eval(s) -tkc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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