Question
Asked By – Alex Gordon
I am running this:
import csv
import sys
reader = csv.reader(open(sys.argv[0], "rb"))
for row in reader:
print row
And I get this in response:
['import csv']
['import sys']
['reader = csv.reader(open(sys.argv[0]', ' "rb"))']
['for row in reader:']
[' print row']
>>>
For the sys.argv[0]
I would like it to prompt me to enter a filename.
How do I get it to prompt me to enter a filename?
Now we will see solution for issue: Getting user input [duplicate]
Answer
In python 3.x, use input()
instead of raw_input()
This question is answered By – Sunny Tambi
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0