[docs] confusing docs for plistlib - how to use 'dump()'

Mariatta Wijaya mariatta.wijaya at gmail.com
Tue Dec 6 12:19:00 EST 2016


Hi,

It is stated in the docs that fp parameter in plistlib.dump is a writable
binary file object, which can be created by calling open() .
file object and how to create it are described here:
https://docs.python.org/3/glossary.html#term-file-object

Perhaps an improvement to the docs is to provide such link?

Here's an example demonstrating how to use plistlib.dump:

import plistlib
p = {"name": "James Bond",
      "code": 0.07}
plistlib.dump(p, open("./output.xml", "wb+"))

HTH


On Dec 6, 2016 5:49 AM, "Mark" <mark at markjharris.net> wrote:

> Hi there -
>
> This regards the page for plistlib:
>
> https://docs.python.org/dev/library/plistlib.html#plistlib.dumps
>
> I ran in to this problem described here:
>
> http://technology.siprep.org/how-to-read-from-and-write-to-p
> list-files-using-python/
>
> It’s just not clear in the docs how to use ‘dump’ - and the only way I
> could get a plist to be created is to use the deprecated
> plistlib.writePlist function.
>
> Does it have to be imported from some other module?
>
> Mark
>
>
>
> _______________________________________________
> docs mailing list
> docs at python.org
> https://mail.python.org/mailman/listinfo/docs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20161206/760389f8/attachment.html>


More information about the docs mailing list