Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3f969022
Commit
3f969022
authored
Nov 23, 2006
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #1601630: little improvement to getopt docs
parent
39b8b6af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
Doc/lib/libgetopt.tex
Doc/lib/libgetopt.tex
+6
-3
No files found.
Doc/lib/libgetopt.tex
View file @
3f969022
...
...
@@ -126,8 +126,9 @@ import getopt, sys
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "ho:v", ["help", "output="])
except getopt.GetoptError:
except getopt.GetoptError
, err
:
# print help information and exit:
print str(err) # will print something like "option -a not recognized"
usage()
sys.exit(2)
output = None
...
...
@@ -135,11 +136,13 @@ def main():
for o, a in opts:
if o == "-v":
verbose = True
if o in ("-h", "--help"):
el
if o in ("-h", "--help"):
usage()
sys.exit()
if o in ("-o", "--output"):
el
if o in ("-o", "--output"):
output = a
else:
assert False, "unhandled option"
# ...
if
__
name
__
== "
__
main
__
":
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment