你问的问题不是非常清楚。
我只能假设你要的是这样的效果。
try:
number = int( raw_input("please enter a number: "))
except ValueError:
print "Invalid number !"
Q: I can’t combine argv with raw_input().
A: Don’t over think it. Just slap two lines at the end of this script that uses raw_input() to get something and then print it. From that, start playing with more ways to use both in the same script.
-----From Learn Python the Hard Way, 3rd Edition
【答案翻译~转】别想太多了。在脚本结尾加两行 raw_input() 随便读取点用户输入就行了,然后再慢慢在脚本中玩玩这两个东东。