Getting user input [duplicate] Getting user input [duplicate] python python

Getting user input [duplicate]


Use the raw_input() function to get input from users (2.x):

print "Enter a file name:",filename = raw_input()

or just:

filename = raw_input('Enter a file name: ')

or if in Python 3.x:

filename = input('Enter a file name: ')


In python 3.x, use input() instead of raw_input()


sys.argv[0] is not the first argument but the filename of the python program you are currently executing. I think you want sys.argv[1]