python dict格式的转储程序。

dictdumper的Python项目详细描述


听写转储程序

dictdumper项目是一个开源的python程序,用作dict的流格式输出转储程序。

  • About
    • dictdumper.Dumper
    • dictdumper.JSON
    • dictdumper.PLIST
    • dictdumper.Tree
    • dictdumper.XML
    • dictdumper.HTML
  • Installation
  • Usage

关于

目前支持以下格式--

  • dictdumper.Dumper——所有转储程序的抽象基类
  • dictdumper.JSON——转储javascript对象表示法(JSON)格式文件
  • dictdumper.PLIST——转储Apple属性列表(PLIST)格式文件
  • dictdumper.Tree——转储树视图文本(TXT)格式文件
  • dictdumper.XML——转储可扩展标记语言(XML)文件(基类
  • dictdumper.HTML——在Vue.js框架下转储javascript文件(已弃用

安装:

Note that dictdumper supports Python versions 2.7 and all versions since 3.0

pip install dictdumper

使用量

dictdumper很容易使用。在安装、导入和初始化之后,您可以简单地调用实例来转储内容。

Take dictdumper.Tree for example

importdictdumperdumper=dictdumper.Tree('out.txt')test_1=dict(foo=-1,# intbar='Hello, world!',# stringboo=dict(# dictfoo_again=True,# boolbar_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
importdatetimetest_2=dict(foo=[1,2.0,3],# listbar=(1.0,2,3.0),# tupleboo=dict(# dictfoo_again='a long long bytes',# bytesbar_again=datetime.datetime.today(),# datetimeboo_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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java MongoOperations Upert/FindModify删除mongo中的所有字段   java括号中的二叉树,而!=空值无效   java com.*.*.**。安全CustomUserDetail无法强制转换为com。***。安全CustomUserDetail   java如何编写多线程算法来发现可用socket   java Spring Boot Solr:子文档的索引列表   java如何向maven shade插件添加外部jar文件   java zebra条形码扫描仪Android studio集成   java为什么一个地方的原始类型会导致其他地方的通用调用站点被视为原始类型?   java将swing控件拆分为相等的部分   java如何在jshell中为spring项目设置类路径   java关于如何从API级别19的时间选择器中删除此白边的提示?   存储二进制字符串所有可能序列的算法,Java   测试JUnitJava。lang.NullPointerException   java Google AppEngine数据库   JavaSpring如何向数据对象注入@Value?   在eclipse java项目中包含mavenant构建库   带有JSP/EL的java省略号(缩写文本)