[Tutor] Suggestions to improve this first effort?

Tiger12506 keridee at jayco.net
Sun Feb 17 02:23:40 CET 2008


> infile$ = "ad.txt"
> outfile$ = "ad.csv"

> infile=sys.argv[1]
> outfile=sys.argv[1]+".csv"

And these will give two different results. The QBasic version says
"ad.txt"
"ad.csv"

whereas the python version will give
"ad.txt"
"ad.txt.csv"

so you need to say

infile = sys.argv[1]
outfile = sys.argv[1][:-3]+'csv'

or something equivalent.


More information about the Tutor mailing list