I have a file called students.csv that I am trying to pass into a python script s1.py. On the command line I type python3 s1.py students.csv, however I get the error
File "s1.py", line 7, in <module>
with open(file, 'r') as studentGrades:
TypeError: invalid file: ['s1.py', 'students.csv']
Here is the code in s1.py:
#!/usr/bin/env Python3
import sys
file = sys.argv
with open(file, 'r') as studentGrades:
for line in studentGrades:
print(line)
How do I pass in this file correctly so I can use it in my python script?