Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11790
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.093 |
| X-Spam-Evidence | '*H*': 0.81; '*S*': 0.00; 'function,': 0.07; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.16; 'subject:list': 0.18; 'header:In-Reply-To:1': 0.22; 'dictionary': 0.23; 'pm,': 0.24; 'aug': 0.24; 'thu,': 0.28; 'module.': 0.29; 'message-id:@mail.gmail.com': 0.29; 'url:library': 0.31; 'skip:\xa0 30': 0.32; 'to:addr:python-list': 0.33; '8bit%:3': 0.34; 'subject:How': 0.35; 'regular': 0.35; 'url:python': 0.36; 'instead.': 0.37; 'variables': 0.37; 'using': 0.37; 'received:google.com': 0.38; 'url:org': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'url:docs': 0.39; 'to:addr:python.org': 0.39; "it's": 0.40; 'your': 0.61; 'john': 0.62; 'url:functions': 0.84; 'need,': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=PdRBSZPbIP0gTt9Y7nu2QgPHO5EEaahlDg/EAFO3S8g=; b=RwUMT5a+lSCddQAHX1wZRabbfFJ+fkQK0jPdPuPUiab7z1IJjmdnXa9J2xQm7mjqT8 O132oLwrkXXGYxMwd6ZJRfCpgqzYL6bYF/SJCu6nAP/pQ2RnTE9C4KtD9PD0R8G1BCOA Sz2sabwgqG9FR0uyqzO1eLfCSJ6C9TcPc/tG0= |
| MIME-Version | 1.0 |
| In-Reply-To | <j2jdg7$ie2$1@reader1.panix.com> |
| References | <2ab25f69-6017-42a6-a7ef-c71bc2ee8547@l2g2000vbn.googlegroups.com> <j2jdg7$ie2$1@reader1.panix.com> |
| Date | Thu, 18 Aug 2011 18:48:56 +0100 |
| Subject | Re: How to convert a list of strings into a list of variables |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.183.1313689739.27778.python-list@python.org> (permalink) |
| Lines | 13 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1313689739 news.xs4all.nl 23913 [2001:888:2000:d::a6]:35916 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:11790 |
Show key headers only | View raw
On Thu, Aug 18, 2011 at 5:09 PM, John Gordon <gordon@panix.com> wrote: > for x in list_of_strings: > list_of_variables.append(eval(x)) > If this really is what you need, you can simplify it by using the globals() dictionary - it's a regular dictionary whose contents are all the global variables in your current module. Inside a function, use locals() instead. http://docs.python.org/library/functions.html#globals ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to convert a list of strings into a list of variables noydb <jenn.duerr@gmail.com> - 2011-08-18 07:57 -0700
Re: How to convert a list of strings into a list of variables David Robinow <drobinow@gmail.com> - 2011-08-18 11:12 -0400
Re: How to convert a list of strings into a list of variables noydb <jenn.duerr@gmail.com> - 2011-08-18 08:19 -0700
Re: How to convert a list of strings into a list of variables Jerry Hill <malaclypse2@gmail.com> - 2011-08-18 11:29 -0400
Re: How to convert a list of strings into a list of variables noydb <jenn.duerr@gmail.com> - 2011-08-18 08:54 -0700
Re: How to convert a list of strings into a list of variables John Gordon <gordon@panix.com> - 2011-08-18 16:09 +0000
Re: How to convert a list of strings into a list of variables Chris Angelico <rosuav@gmail.com> - 2011-08-18 18:48 +0100
Re: How to convert a list of strings into a list of variables Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-19 11:42 +1000
Re: How to convert a list of strings into a list of variables Nobody <nobody@nowhere.com> - 2011-08-18 19:45 +0100
Re: How to convert a list of strings into a list of variables AB <antonio.a.barbosa@gmail.com> - 2011-08-18 15:05 -0700
Re: How to convert a list of strings into a list of variables Kingsley Adio <adiksonline@gmail.com> - 2011-08-19 00:39 -0700
Re: How to convert a list of strings into a list of variables Roy Smith <roy@panix.com> - 2011-08-19 08:57 -0400
Re: How to convert a list of strings into a list of variables noydb <jenn.duerr@gmail.com> - 2011-08-19 07:32 -0700
csiph-web