Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Python by (47.6k points)

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?

1 Answer

0 votes
by (106k points)

For getting user input in python 3.x, you can use input() instead of raw_input().

To know more about this you can have a look at the following video tutorial:-

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...