File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,8 @@ exception:
92
92
93
93
An example using only Unix style options:
94
94
95
+ .. doctest ::
96
+
95
97
>>> import getopt
96
98
>>> args = ' -a -b -cfoo -d bar a1 a2' .split()
97
99
>>> args
@@ -104,6 +106,8 @@ An example using only Unix style options:
104
106
105
107
Using long option names is equally easy:
106
108
109
+ .. doctest ::
110
+
107
111
>>> s = ' --condition=foo --testing --output-file abc.def -x a1 a2'
108
112
>>> args = s.split()
109
113
>>> args
@@ -115,7 +119,9 @@ Using long option names is equally easy:
115
119
>>> args
116
120
['a1', 'a2']
117
121
118
- In a script, typical usage is something like this::
122
+ In a script, typical usage is something like this:
123
+
124
+ .. testcode ::
119
125
120
126
import getopt, sys
121
127
@@ -145,7 +151,9 @@ In a script, typical usage is something like this::
145
151
main()
146
152
147
153
Note that an equivalent command line interface could be produced with less code
148
- and more informative help and error messages by using the :mod: `argparse ` module::
154
+ and more informative help and error messages by using the :mod: `argparse ` module:
155
+
156
+ .. testcode ::
149
157
150
158
import argparse
151
159
You can’t perform that action at this time.
0 commit comments