[Tutor] Beginner puzzle with unpacking argv
Lisi
lisi.reisz at gmail.com
Thu Jun 16 19:10:58 CEST 2011
Copied and pasted:
From text of Learn Python the Hard Way
1 from sys import argv
2
3 script, user_name = argv
From my script (typed, not copied and pasted, but copied and pasted from my
script to here):
1 from sys import argv
2
3 script, user_name = argv
I have tried every permutation of white space I could think of that might have
looked like the original, but I always get the same error:
lisi at Tux:~/Python/LearnPythonTheHardWay$ python ex14.py
Traceback (most recent call last):
File "ex14.py", line 3, in <module>
script, user_name=argv
ValueError: need more than 1 value to unpack
I haven't got past line 3 yet!! I know that you need the right number of
variables, but my script has got as many as the original - it's the same as
the original!
Help!
Lisi
More information about the Tutor
mailing list