Okay, i've just started python a few days ago, and i think i'm doing well considering how quickly I"ve been working, but I've reached a dead end!!
I keep encountering an error when using the statement "from sys import argv"
In the first code were I had this problem, I managed to modify it a bit so that it works, but not to what i would have hoped, here is the first code
from sys import argv script, user_name = argv prompt = '> ' print "Hi %s, I'm the %s script." % (user_name, script) print "I'd like to ask you a few questions." print "Do you like me %s?" % user_name likes = raw_input(prompt) print "Where do you live %s?" % user_name lives = raw_input(prompt) print "What kind of computer do you have?" computer = raw_input(prompt) print""" Alright, so you said %r about liking me. You live near me in %r. And you have a %r computer. Nice """ % (likes, lives, computer)
and here is the second
from sys import argv script, filename, = argv txt = open(filename) print "Here's your file %r:" % filename print txt.read() print "I'll also ask you to type it again:" file_again = raw_input("> ") text_again = open(file_again) print txt_again.read()
the error i keep getting is "line 3, in <module>
script, user_name = argv ValueError: need more than 1 value to unpack " for the first on and "line 3, in <module> script, filename, = argv ValueError: need more than 1 value to unpack"
for the second one,
Thanks in advanced for the help,
And if it changes anything i am using mac 10.6.4 and have the latest version of python 2
Edited 3 Years Ago by mike_2000_17: Fixed formatting