File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1735,6 +1735,7 @@ \subsection{The \module{optparse} Module}
17351735it what your program's options are.
17361736
17371737\begin {verbatim }
1738+ import sys
17381739from optparse import OptionParser
17391740
17401741op = OptionParser()
@@ -1750,7 +1751,9 @@ \subsection{The \module{optparse} Module}
17501751method.
17511752
17521753\begin {verbatim }
1753- options, args = op.parse_args(sys.argv[1:])
1754+ import optparse
1755+
1756+ options, args = optparse.parse_args(sys.argv[1:])
17541757print options
17551758print args
17561759\end {verbatim }
@@ -1768,7 +1771,7 @@ \subsection{The \module{optparse} Module}
17681771['arg1']
17691772$ ./python opt.py --input=data --length=4
17701773<Values at 0x400cad2c: {'input': 'data', 'length': 4}>
1771- ['arg1' ]
1774+ []
17721775$
17731776\end {verbatim }
17741777
You can’t perform that action at this time.
0 commit comments