[Tutor] CLI args [was:Re: Tutor Digest, Vol 132, Issue 57]

Alan Gauld alan.gauld at btinternet.com
Fri Feb 27 14:02:14 CET 2015


On 27/02/15 12:31, Rishi Ganesh V wrote:

> in the script it is like
> def convert(inputfile, outputfile):
>    reader = csv.reader(open(inputfile, "rb"))
>    file = open(outputfile, 'w+')
> ......
>
>
>
> inputfile=sys.argv[1] , output file=sys.argv[2]
>
> convert(inputfile,outputfile)

The assignments need to be on separate lines not comma separated

Then, assuming your script is called myscript.py you call it like

$ python myscript.py myinputfile.csv myoutputfile.txt

You can find more in the "talking to the User" topic of my
tutorial (see below)

Please do not send the entire digest, some people pay by the byte.

Also change the subject line to something descriptive so it can be found 
in the archives.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list