Python dict formatted dumper.
Project description
DictDumper
The dictdumper
project is an open source Python program works as a stream formatted output dumper for dict
.
- About
dictdumper.Dumper
dictdumper.JSON
dictdumper.PLIST
dictdumper.Tree
dictdumper.XML
dictdumper.HTML
- Installation
- Usage
About
Currently, it supports following formats --
dictdumper.Dumper
-- abstract base class of all dumpersdictdumper.JSON
-- dump JavaScript object notation (JSON
) format filedictdumper.PLIST
-- dump Apple property list (PLIST
) format filedictdumper.Tree
-- dump tree-view text (TXT
) format filedictdumper.XML
-- dump extensible Mmarkup language (XML
) file (base class)dictdumper.HTML
-- dump JavaScript file underVue.js
framework (DEPRECATED)
Installation:
Note that
dictdumper
supports Python versions 2.7 and all versions since 3.0
pip install dictdumper
Usage
dictdumper
is quite easy to use. After installation, importation, and initialisation, you can simple call the instance to dump contents.
Take
dictdumper.Tree
for example
import dictdumper
dumper = dictdumper.Tree('out.txt')
test_1 = dict(
foo = -1, # int
bar = 'Hello, world!', # string
boo = dict( # dict
foo_again = True, # bool
bar_again = b'bytes', # bytes (b'\x62\x79\x74\x65\x73')
boo_again = None, # NoneType
),
)
dumper(test_1, name='test_1')
$ cat out.txt
PCAP File Tree-View Format
test
|-- foo -> -1
|-- bar -> hello
|-- boo
|-- foo_again -> True
|-- bar_again -> 62 79 74 65 73
|-- boo_again -> N/A
import datetime
test_2 = dict(
foo = [1, 2.0, 3], # list
bar = (1.0, 2, 3.0), # tuple
boo = dict( # dict
foo_again = 'a long long bytes',
# bytes
bar_again = datetime.datetime.today(),
# datetime
boo_again = -1.0, # float
),
)
dumper(test_2, name='test_2')
$ cat out.txt
PCAP File Tree-View Format
test_1
|-- foo -> -1
|-- bar -> Hello, world!
|-- boo
|-- foo_again -> True
|-- bar_again -> 62 79 74 65 73
|-- boo_again -> N/A
test_2
|-- foo
| |--> 1
| |--> 2.0
| |--> 3
|-- bar
| |--> 1.0
| |--> 2
| |--> 3.0
|-- boo
|-- foo_again -> a long long bytes
|-- bar_again -> 2018-03-08 17:47:35
|-- boo_again -> -1.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dictdumper-0.6.2.post1.tar.gz
(63.1 kB
view hashes)
Built Distribution
Close
Hashes for dictdumper-0.6.2.post1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dad54e7ddca87e455f1f92d98c5d2b24afbc40173c85e68fa3cf5a3807c77bf |
|
MD5 | d1547db54d866c2b806a107d48b5c9b1 |
|
BLAKE2b-256 | 239bbbb4510d02d279924e9de7ae248daddaed6ce0821b8d30a184c0fe9ab69c |