0
python issue
You are tasked with writing a program that will extract values from a specified field from a file. This file will be space (" ") separated. You are expected to use the split() method and correctly extract the specified field that has been specified in the command line arguments. Example 1: python scissors.py 1 cats.txtGinger Mainecoon Lynx Ocelot Example 2: python scissors.py 2 dogs.txtGreatDane Mastiff Shephard Wolf How to deal with this kind of question, many thanks!!!
1 Answer
0
file = open(sys.argv[2], "r").read().split(' ')
for e in file:
print e
Maybe this will help you.