Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ee9b51

Browse files
committed
[Bug #688261] Fix optparse example and output
1 parent acddabc commit 7ee9b51

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Doc/whatsnew/whatsnew23.tex

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,6 +1735,7 @@ \subsection{The \module{optparse} Module}
17351735
it what your program's options are.
17361736

17371737
\begin{verbatim}
1738+
import sys
17381739
from optparse import OptionParser
17391740
17401741
op = OptionParser()
@@ -1750,7 +1751,9 @@ \subsection{The \module{optparse} Module}
17501751
method.
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:])
17541757
print options
17551758
print 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

0 commit comments

Comments
 (0)