diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2011-07-17 17:31:51 +0800 |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2011-07-17 17:31:51 +0800 |
commit | a09f13a0bcbf4c986a9ed2bfa6bd3e7a08f18ee6 (patch) | |
tree | eea80411b1c01452ffafad11e85045706af1b2c7 | |
parent | 877f2e4530a3b9ce87b421f98141f04fa1145c7e (diff) | |
download | cpython-git-a09f13a0bcbf4c986a9ed2bfa6bd3e7a08f18ee6.tar.gz |
merge from 3.2.
-rw-r--r-- | Doc/library/struct.rst | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index 18f6a83b6b..9c7fdd8138 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -257,10 +257,11 @@ not contain whitespace though. For the ``'s'`` format character, the count is interpreted as the size of the string, not a repeat count like for the other format characters; for example, ``'10s'`` means a single 10-byte string, while ``'10c'`` means 10 characters. -For packing, the string is truncated or padded with null bytes as appropriate to -make it fit. For unpacking, the resulting string always has exactly the -specified number of bytes. As a special case, ``'0s'`` means a single, empty -string (while ``'0c'`` means 0 characters). +If a count is not given, it defaults to 1. For packing, the string is +truncated or padded with null bytes as appropriate to make it fit. For +unpacking, the resulting string always has exactly the specified number of +bytes. As a special case, ``'0s'`` means a single, empty string (while +``'0c'`` means 0 characters). The ``'p'`` format character encodes a "Pascal string", meaning a short variable-length string stored in a *fixed number of bytes*, given by the count. |