Using the command line, my program would take a .txt input.
The syntax my prof show to do this is:
python main.py < input.txt
but I get the error IndexError: list index out of range
The code I used to open files:
import.sys
if len(sys.argv[1]) <= 0:
print("Please input a file path")
exit(-1)
with open(sys.argv[1], 'r') as input_file:
# loops to create new "arg" array for every new line
for line in input_file.readlines():
How can I fix this?