Assigning multiple variables to a list a la php's list()
clp2 at rebertia.com
Thu May 14 00:24:06 EDT 2009
On Wed, May 13, 2009 at 9:17 PM, Wells <wells at submute.net> wrote:
> Can you take a list and have it exploded into variables w/ one
> command? Something like..
> list = ['foo', 'bar']
> [a, b] = list
> Then 'a' would be foo and 'b' 'bar'.
Did you think to try it at the interpreter? That exact syntax works,
though we usually write it without the brackets, like:
a, b = list
Also, don't use "list" as a variable name since it clashes with the
More information about the Python-list