"Andreu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
Yes, ... don't ask me why, but in fact v1,v2,v3 = str1.split()
does not seem to work. My original problem was I forgot about
the parenthesis as Tim point out. So I ended up converting to a
list as in: v = str1.split() and accessing the elements using
v[0] v[1] ect...it is working now. Thanks.
Andreu.
v1,v2,v3 = str1.split() will only work if there are exactly three things in
str1.
s = 'this is a test'
v1,v2,v3 = s.split()
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ValueError: too many values to unpack
v1,v2,v3 = s.split(' ',2) # limit to two splits maximum
v1
'this'
v2
'is'
v3
'a test'
-Mark
--
http://mail.python.org/mailman/listinfo/python-list