summaryrefslogtreecommitdiffstats
path: root/Doc/library/struct.rst
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2011-07-17 09:29:17 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2011-07-17 09:29:17 (GMT)
commitad3882a2b0c178eaa220eb07f768aecff78ec468 (patch)
tree0c923798f19ec892e919b492e453715f76b1e1d9 /Doc/library/struct.rst
parent0b447957c75778145ef8ce46d95d4a780cd0e1ab (diff)
downloadcpython-ad3882a2b0c178eaa220eb07f768aecff78ec468.zip
cpython-ad3882a2b0c178eaa220eb07f768aecff78ec468.tar.gz
cpython-ad3882a2b0c178eaa220eb07f768aecff78ec468.tar.bz2
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 42bfc14..12820e0 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'``,