Issue
I'm doing ex13 from Learn Python The Hard Way
I'm trying to pass:
python ex13.py raw_input() raw_input() raw_input()
my code is below:
from sys import argv
script, first, second, third = argv
print "The script is called:", script
print "Your first variable is:", first
print "Your second variable is:", second
print "Your third variable is:", third
The error I keep getting is:
Traceback (most recent call last):
File "ex13.py", line 5, in <module>
script, first, second, third = argv
ValueError: too many values to unpack
I want to know why i'm getting this error and how to fix it
Solution
You cannot "use raw_input()
with argv
". argv
is supplied with data that you specify before running the program. raw_input()
is a Python function, i.e. something that your program can do. The command line - where you type the python
command in order to run your program - is a completely separate thing from the program itself.
Answered By - Karl Knechtel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.