summaryrefslogtreecommitdiffstats
path: root/Doc/library/plistlib.rst
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2009-09-13 07:54:02 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2009-09-13 07:54:02 (GMT)
commit985e24dcf7368894f945c360c383059a21b1ba0b (patch)
tree4736769c0e526b53c8a98c3dfd213e5bf9c89bb1 /Doc/library/plistlib.rst
parentb5845056da831ee3bad9400d5fe9dcd88f9ae534 (diff)
downloadcpython-985e24dcf7368894f945c360c383059a21b1ba0b.zip
cpython-985e24dcf7368894f945c360c383059a21b1ba0b.tar.gz
cpython-985e24dcf7368894f945c360c383059a21b1ba0b.tar.bz2
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 cf3dd82..ed83e1a 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::