diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2003-02-18 00:48:23 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2003-02-18 00:48:23 (GMT) |
commit | 7ee9b51ba5218798e796d608631dec2d6f3dcbe4 (patch) | |
tree | f6f61b06fedb0309610661b40c0462569cc902e3 /Doc/whatsnew | |
parent | acddabc6ecf60c755e9b9aa562bd758c7f858a9d (diff) | |
download | cpython-7ee9b51ba5218798e796d608631dec2d6f3dcbe4.zip cpython-7ee9b51ba5218798e796d608631dec2d6f3dcbe4.tar.gz cpython-7ee9b51ba5218798e796d608631dec2d6f3dcbe4.tar.bz2 |
[Bug #688261] Fix optparse example and output
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/whatsnew23.tex | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Doc/whatsnew/whatsnew23.tex b/Doc/whatsnew/whatsnew23.tex index 4b7c520..2075244 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 <Values at 0x400cad2c: {'input': 'data', 'length': 4}> -['arg1'] +[] $ \end{verbatim} |