From: Andrew M. Kuchling Date: Tue, 18 Feb 2003 00:48:23 +0000 (+0000) Subject: [Bug #688261] Fix optparse example and output X-Git-Tag: v2.3c1~1811 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7ee9b51ba5218798e796d608631dec2d6f3dcbe4;p=thirdparty%2FPython%2Fcpython.git [Bug #688261] Fix optparse example and output --- diff --git a/Doc/whatsnew/whatsnew23.tex b/Doc/whatsnew/whatsnew23.tex index 4b7c520b742f..2075244b81b1 100644 --- a/Doc/whatsnew/whatsnew23.tex +++ b/Doc/whatsnew/whatsnew23.tex @@ -1735,6 +1735,7 @@ You start by creating an instance of \class{OptionParser} and telling it what your program's options are. \begin{verbatim} +import sys from optparse import OptionParser op = OptionParser() @@ -1750,7 +1751,9 @@ Parsing a command line is then done by calling the \method{parse_args()} method. \begin{verbatim} -options, args = op.parse_args(sys.argv[1:]) +import optparse + +options, args = optparse.parse_args(sys.argv[1:]) print options print args \end{verbatim} @@ -1768,7 +1771,7 @@ $ ./python opt.py -i data arg1 ['arg1'] $ ./python opt.py --input=data --length=4 -['arg1'] +[] $ \end{verbatim}