summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-04-29 04:37:13 +0000
committerRaymond Hettinger <python@rcn.com>2003-04-29 04:37:13 +0000
commit9b88e1587f7c0b9119c8ba2a11f9d4855f14aa0c (patch)
treed8dde333ab77f839b28a52cfa86a42004c6e6abd
parent971f0f0fb4c2cb48fd428d8f474834997da3f006 (diff)
downloadcpython-git-9b88e1587f7c0b9119c8ba2a11f9d4855f14aa0c.tar.gz
SF bug #729096: getopt online documentation example improvement
A newbie found it difficult to translate the exampe into a case that used only short options or long options but not both. He tried to shorten the tuple search but forgot the trailing comma, The appropriate pattern is an equality check. Revised the example to point him in the right direction.
-rw-r--r--Doc/lib/libgetopt.tex5
1 files changed, 4 insertions, 1 deletions
diff --git a/Doc/lib/libgetopt.tex b/Doc/lib/libgetopt.tex
index 1348921f56..c1763c5fc2 100644
--- a/Doc/lib/libgetopt.tex
+++ b/Doc/lib/libgetopt.tex
@@ -111,13 +111,16 @@ import getopt, sys
def main():
try:
- opts, args = getopt.getopt(sys.argv[1:], "ho:", ["help", "output="])
+ opts, args = getopt.getopt(sys.argv[1:], "ho:v", ["help", "output="])
except getopt.GetoptError:
# print help information and exit:
usage()
sys.exit(2)
output = None
+ verbose = False
for o, a in opts:
+ if o == "-v":
+ verbose = True
if o in ("-h", "--help"):
usage()
sys.exit()