summaryrefslogtreecommitdiff
path: root/Doc/library/struct.rst
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2011-07-17 17:29:17 +0800
committerSenthil Kumaran <senthil@uthcode.com>2011-07-17 17:29:17 +0800
commit2b007f596431d4a4275f3ad23a1c9974793c781c (patch)
tree2b254fd15c91425ba31690fb28c9f1b5c08609c7 /Doc/library/struct.rst
parentdcbff20967fabbe57ae4dc17cf5264b4e014a7ef (diff)
downloadcpython-2b007f596431d4a4275f3ad23a1c9974793c781c.tar.gz
Fix closes Issue11436 - Minor clarification to struct documentation for 's' format character.
Diffstat (limited to 'Doc/library/struct.rst')
-rw-r--r--Doc/library/struct.rst9
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst
index 42bfc14d96..12820e0282 100644
--- a/Doc/library/struct.rst
+++ b/Doc/library/struct.rst
@@ -240,10 +240,11 @@ not contain whitespace though.
For the ``'s'`` format character, the count is interpreted as the length of the
bytes, 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 bytes object 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 bytes object always has exactly the specified number
+of bytes. As a special case, ``'0s'`` means a single, empty string (while
+``'0c'`` means 0 characters).
When packing a value ``x`` using one of the integer formats (``'b'``,
``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``,