From 985e24dcf7368894f945c360c383059a21b1ba0b Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Sun, 13 Sep 2009 07:54:02 +0000 Subject: fixed more examples that were using u"", print without () and unicode/str instead of str/bytes --- Doc/library/plistlib.rst | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'Doc/library/plistlib.rst') 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 ```` 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="", - aUnicodeValue=u'M\xe4ssig, Ma\xdf', - aTrueValue=True, - aFalseValue=False, + aDict = dict( + anotherString = "", + aThirdString = "M\xe4ssig, Ma\xdf", + aTrueValue = True, + aFalseValue = False, ), someData = Data(""), someMoreData = Data("" * 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:: -- cgit v1.2.1