File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ devoted to discussing various metacharacters and what they do.
7676Here's a complete list of the metacharacters; their meanings will be discussed
7777in the rest of this HOWTO. ::
7878
79- . ^ $ * + ? { [ ] \ | ( )
79+ . ^ $ * + ? { } [ ] \ | ( )
8080
8181The first metacharacters we'll look at are ``[ `` and ``] ``. They're used for
8282specifying a character class, which is a set of characters that you wish to
Original file line number Diff line number Diff line change @@ -282,7 +282,8 @@ implement its socket handling::
282282 asyncore.dispatcher.__init__(self)
283283 self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
284284 self.connect( (host, 80) )
285- self.buffer = bytes('GET %s HTTP/1.0\r\n\r\n' % path, 'ascii')
285+ self.buffer = bytes('GET %s HTTP/1.0\r\nHost: %s\r\n\r\n' %
286+ (path, host), 'ascii')
286287
287288 def handle_connect(self):
288289 pass
Original file line number Diff line number Diff line change @@ -1173,6 +1173,9 @@ Several constants are available to specify character cell attributes:
11731173+------------------+-------------------------------+
11741174| ``A_NORMAL `` | Normal attribute. |
11751175+------------------+-------------------------------+
1176+ | ``A_REVERSE `` | Reverse background and |
1177+ | | foreground colors. |
1178+ +------------------+-------------------------------+
11761179| ``A_STANDOUT `` | Standout mode. |
11771180+------------------+-------------------------------+
11781181| ``A_UNDERLINE `` | Underline mode. |
Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ The :mod:`locale` module defines the following exception and functions:
161161 .. data :: D_T_FMT
162162
163163 Get a string that can be used as a format string for :func: `strftime ` to
164- represent time and date in a locale-specific way.
164+ represent date and time in a locale-specific way.
165165
166166 .. data :: D_FMT
167167
@@ -246,12 +246,17 @@ The :mod:`locale` module defines the following exception and functions:
246246
247247 .. data :: ERA_D_T_FMT
248248
249- Get a format string for :func: `strftime ` to represent dates and times in a
249+ Get a format string for :func: `strftime ` to represent date and time in a
250250 locale-specific era-based way.
251251
252252 .. data :: ERA_D_FMT
253253
254- Get a format string for :func: `strftime ` to represent time in a
254+ Get a format string for :func: `strftime ` to represent a date in a
255+ locale-specific era-based way.
256+
257+ .. data :: ERA_T_FMT
258+
259+ Get a format string for :func: `strftime ` to represent a time in a
255260 locale-specific era-based way.
256261
257262 .. data :: ALT_DIGITS
Original file line number Diff line number Diff line change @@ -2311,7 +2311,7 @@ copying. Memory is generally interpreted as simple bytes.
23112311.. class :: memoryview(obj)
23122312
23132313 Create a :class: `memoryview ` that references *obj *. *obj * must support the
2314- buffer protocol. Builtin objects that support the buffer protocol include
2314+ buffer protocol. Built-in objects that support the buffer protocol include
23152315 :class: `bytes ` and :class: `bytearray `.
23162316
23172317 A :class: `memoryview ` has the notion of an *element *, which is the
Original file line number Diff line number Diff line change @@ -2306,9 +2306,11 @@ The demo scripts are:
23062306| bytedesign | complex classical | :func:`tracer`, delay,|
23072307| | turtle graphics pattern | :func: `update ` |
23082308+----------------+------------------------------+-----------------------+
2309- | chaos | graphs verhust dynamics, | world coordinates |
2310- | | proves that you must not | |
2311- | | trust computers' computations| |
2309+ | chaos | graphs Verhulst dynamics, | world coordinates |
2310+ | | shows that computer's | |
2311+ | | computations can generate | |
2312+ | | results sometimes against the| |
2313+ | | common sense expectations | |
23122314+----------------+------------------------------+-----------------------+
23132315| clock | analog clock showing time | turtles as clock's |
23142316| | of your computer | hands, ontimer |
Original file line number Diff line number Diff line change @@ -119,9 +119,6 @@ square brackets, is recursively defined as follows.
119119* If the target list is a comma-separated list of targets: The object must be an
120120 iterable with the same number of items as there are targets in the target list,
121121 and the items are assigned, from left to right, to the corresponding targets.
122- (This rule is relaxed as of Python 1.5; in earlier versions, the object had to
123- be a tuple. Since strings are sequences, an assignment like ``a, b = "xy" `` is
124- now legal as long as the string has the right length.)
125122
126123 * If the target list contains one target prefixed with an asterisk, called a
127124 "starred" target: The object must be a sequence with at least as many items
@@ -991,10 +988,3 @@ pre-existing bindings in the local scope.
991988
992989 :pep: `3104 ` - Access to Names in Outer Scopes
993990 The specification for the :keyword: `nonlocal ` statement.
994-
995-
996- .. rubric :: Footnotes
997-
998- .. [# ] It may occur within an :keyword: `except ` or :keyword: `else ` clause. The
999- restriction on occurring in the :keyword: `try ` clause is implementor's
1000- laziness and will eventually be lifted.
Original file line number Diff line number Diff line change @@ -19,18 +19,16 @@ the :func:`print` function. (A third way is using the :meth:`write` method
1919of file objects; the standard output file can be referenced as ``sys.stdout ``.
2020See the Library Reference for more information on this.)
2121
22- .. index :: module: string
23-
2422Often you'll want more control over the formatting of your output than simply
2523printing space-separated values. There are two ways to format your output; the
2624first way is to do all the string handling yourself; using string slicing and
2725concatenation operations you can create any layout you can imagine. The
28- standard module :mod: ` string ` contains some useful operations for padding
26+ string type has some methods that perform useful operations for padding
2927strings to a given column width; these will be discussed shortly. The second
3028way is to use the :meth: `str.format ` method.
3129
32- The :mod: `string ` module contains a class Template which offers yet another way
33- to substitute values into strings.
30+ The :mod: `string ` module contains a : class: ` ~string. Template` class which offers
31+ yet another way to substitute values into strings.
3432
3533One question remains, of course: how do you convert values to strings? Luckily,
3634Python has ways to convert any value to a string: pass it to the :func: `repr `
You can’t perform that action at this time.
0 commit comments