ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: Assignments and Variable Substitution
by Evan Klitzke other posts by this author
Aug 13 2007 2:38PM messages near this date
Assignments and Variable Substitution | Re: Assignments and Variable Substitution
On 8/13/07, brad <byte8bits@[...].com>  wrote:
>  I'd like to do something like this:
> 
>  var = '123'
>  %s = [], %var
> 
>  So that, in the end, var is '123' and an empty list is named '123' as
>  well. The list assignments are created during a loop.

You can't assign a variable whose name is 123, but you can do this
sort of thing with setattr.

-- 
Evan Klitzke <evan@[...].com> 
-- 
http://mail.python.org/mailman/listinfo/python-list
Thread:
Brad
Evan Klitzke
Srage

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved