summaryrefslogtreecommitdiff
path: root/Doc/library/plistlib.rst
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2009-09-13 07:54:02 +0000
committerEzio Melotti <ezio.melotti@gmail.com>2009-09-13 07:54:02 +0000
commitfc6e71bae1d609507d5af703615aab83f8b6d6f4 (patch)
treeeb0c1ba8b414ee9b666e3d5e4e8c27409481c5be /Doc/library/plistlib.rst
parente7ec2ca4689eef6193c53b0255ce16f6b75df901 (diff)
downloadcpython-fc6e71bae1d609507d5af703615aab83f8b6d6f4.tar.gz
fixed more examples that were using u"", print without () and unicode/str instead of str/bytes
Diffstat (limited to 'Doc/library/plistlib.rst')
-rw-r--r--Doc/library/plistlib.rst18
1 files changed, 8 insertions, 10 deletions
diff --git a/Doc/library/plistlib.rst b/Doc/library/plistlib.rst
index cf3dd8241e..ed83e1a1e9 100644
--- a/Doc/library/plistlib.rst
+++ b/Doc/library/plistlib.rst
@@ -20,7 +20,7 @@ top level object is a dictionary.
Values can be strings, integers, floats, booleans, tuples, lists, dictionaries
(but only with string keys), :class:`Data` or :class:`datetime.datetime`
-objects. String values (including dictionary keys) may be unicode strings --
+objects. String values (including dictionary keys) has to be unicode strings --
they will be written out as UTF-8.
The ``<data>`` plist type is supported through the :class:`Data` class. This is
@@ -83,22 +83,20 @@ Examples
Generating a plist::
pl = dict(
- aString="Doodah",
- aList=["A", "B", 12, 32.1, [1, 2, 3]],
+ aString = "Doodah",
+ aList = ["A", "B", 12, 32.1, [1, 2, 3]],
aFloat = 0.1,
anInt = 728,
- aDict=dict(
- anotherString="<hello & hi there!>",
- aUnicodeValue=u'M\xe4ssig, Ma\xdf',
- aTrueValue=True,
- aFalseValue=False,
+ aDict = dict(
+ anotherString = "<hello & hi there!>",
+ aThirdString = "M\xe4ssig, Ma\xdf",
+ aTrueValue = True,
+ aFalseValue = False,
),
someData = Data("<binary gunk>"),
someMoreData = Data("<lots of binary gunk>" * 10),
aDate = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())),
)
- # unicode keys are possible, but a little awkward to use:
- pl[u'\xc5benraa'] = "That was a unicode key."
writePlist(pl, fileName)
Parsing a plist::