Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36080
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'that?': 0.05; 'alignment': 0.07; 'assign': 0.07; 'dynamically': 0.07; 'subject:Question': 0.07; 'already.': 0.09; 'nb:': 0.09; 'apology': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'fruit': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'wrote:': 0.17; 'variables': 0.17; 'skip:v 30': 0.20; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'creating': 0.26; 'received:192.168.1.3': 0.29; 'received:84': 0.32; 'print': 0.32; 'to:addr:python-list': 0.33; 'list': 0.35; 'something': 0.35; 'but': 0.36; 'bad': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'list,': 0.39; 'received:192.168': 0.40; 'group,': 0.60; 'email addr:gmail.com': 0.63; 'dear': 0.66; 'kindly': 0.67; 'header:Reply-To:1': 0.68; 'reply-to:no real name:2**0': 0.72; 'reply-to:addr:python.org': 0.84; 'take,': 0.84 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.0 cv=HO4d4PRv c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=O2Kvzccb_dQA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=lorKstOQGtUA:10 a=pGLkceISAAAA:8 a=Z_pT0hJIe0vr96T_j28A:9 a=wPNLvfGTeEIA:10 a=MSl-tDqOz04A:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 |
| X-AUTH | mrabarnett:2500 |
| Date | Thu, 03 Jan 2013 20:21:53 +0000 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Question on for loop |
| References | <456df1a1-9225-44e7-9aa9-6b6fe3fde4a0@googlegroups.com> |
| In-Reply-To | <456df1a1-9225-44e7-9aa9-6b6fe3fde4a0@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | python-list@python.org |
| 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.57.1357244517.2939.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1357244517 news.xs4all.nl 6988 [2001:888:2000:d::a6]:35107 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:36080 |
Show key headers only | View raw
On 2013-01-03 20:04, subhabangalore@gmail.com wrote: > Dear Group, > If I take a list like the following: > > fruits = ['banana', 'apple', 'mango'] > for fruit in fruits: > print 'Current fruit :', fruit > > Now, > if I want variables like var1,var2,var3 be assigned to them, we may take, > var1=banana, > var2=apple, > var3=mango > > but can we do something to assign the variables dynamically I was thinking > of > var_series=['var1','var2','var3'] > for var in var_series: > for fruit in fruits: > print var,fruits > > If any one can kindly suggest. > > Regards, > Subhabrata > > NB: Apology for some alignment mistakes,etc. > Why would you want to do that? Creating names dynamically like that is a bad idea. Just keep them in a list, like they are already.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Question on for loop subhabangalore@gmail.com - 2013-01-03 12:04 -0800
Re: Question on for loop MRAB <python@mrabarnett.plus.com> - 2013-01-03 20:21 +0000
Re: Question on for loop Peter Otten <__peter__@web.de> - 2013-01-03 21:22 +0100
Re: Question on for loop Matt Jones <matt.walker.jones@gmail.com> - 2013-01-03 14:28 -0600
Re: Question on for loop Don Ross <donrosszx@gmail.com> - 2013-01-03 15:22 -0800
Re: Question on for loop alex23 <wuwei23@gmail.com> - 2013-01-03 16:47 -0800
Re: Question on for loop Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-04 05:48 +0000
Re: Question on for loop subhabangalore@gmail.com - 2013-01-15 11:30 -0800
Re: Question on for loop Alister <alister.ware@ntlworld.com> - 2013-01-04 10:16 +0000
csiph-web