Explore Courses Blog Tutorials Interview Questions
0 votes
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
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.5k answers


108k users

Browse Categories