How to pass Python command line options (vs arguments) when running script directly vs via Python interpreter?

Malcolm Greene python at bdurham.com
Tue Aug 14 19:47:16 EDT 2018


> You might try:
> from getopt import getopt
> or the (apparently newer):
> from optparse import OptionParser

Thanks Mike. My question was trying to make a distinction between Python options (flags that precede the script or module name) and arguments (the script specific values passed on the command line following the script's name).

Here's a description of the options I'm referring to:
https://docs.python.org/3/using/cmdline.html#generic-options



More information about the Python-list mailing list