NewBie - GetOpts

George Russell george.russell at clara.net
Mon Sep 27 21:40:23 EDT 1999


I'm trying to get a filename passed in as an argument - 
ie myprog -f myfile

So far, I have imported getopt

optlist=getopt.getopt(sys.argv[1:],'f:')

which reads the switch and the argument into a data structure from
which I can't actually access (since I don't even know what kind of
structure - a sequence? a list? a tuple? an array / vector?)(what is a
tuple?)

I'm new to python, and things have been going very well so far.

print optlist gives
([('-f','filename')],[])

I think this has two lists, one empty. Inside what data structure?

Can anyone show me howto access the data? Or point me to the right
place in the tutorial / library reference, or some example code.

Thanks.
George Russell




More information about the Python-list mailing list