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!!!

6th Apr 2018, 1:09 PM
Tony
1 Respuesta
0
file = open(sys.argv[2], "r").read().split(' ') for e in file: print e Maybe this will help you.
6th Apr 2018, 1:21 PM
Bartosz Pieszko
Bartosz Pieszko - avatar