how do I extract the arguments using getopt

Usage:
test.py -P abc -S def -G xyz

How do I extract the values abc, def and xyz?

Recommended Answers

All 2 Replies

Member Avatar for iamthwee

If you have access to test.py (the source code I mean) you could modify it to pipe the values to a text file perhaps.

I don't know about getopt but all of those things are stored in the list stored under sys.argv

>>> import sys
>>> sys.argv[0]
>>> len(sys.argv)

Try those lines and then you should be able to handle the command line arguments yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.