Parse variable into variables >Re: Apology

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Feb 25 21:33:40 EST 2002


Courageous wrote:
> 
> >>> s = "a,b,c,d"
> >>> tple = s.split(",")
> >>> tple
> ['a', 'b', 'c', 'd']

One further tip: you can then "unpack" the tuple
into variables, if you wish, like this:

   var1, var2, var3, var4 = tple

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list