生成数据类而不写入它们!

dtc的Python项目详细描述


https://travis-ci.org/jgirardet/dtc.svg?branch=masterhttps://ci.appveyor.com/api/projects/status/ffd44ndqx713yuhd/branch/master?svg=true

dtc:“生成数据类而不写入它们!“

警告

这是alpha版本

基本用法

>>>importdtc>>>JSON=b"""{"flooat": 12.564, "boolean": true, "integer": 12}""">>>my_class=dtc.from_json(JSON)>>>my_classBase(flooat=12.564,boolean=True,integer=12)>>>fromdataclassesimport*>>>is_dataclass(my_class)True>>>JSON=b"""[{"flooat": 12.4, "boolean": true, "integer": 1}, {"flooat": 12.564, "boolean": true, "integer": 12},{"flooat": 1.4, "boolean": false, "integer": 0}]""">>>dtc.from_json(JSON[Base(flooat=12.4,boolean=True,integer=1),Base(flooat=12.564,boolean=True,integer=12),Base(flooat=1.4,boolean=False,integer=0)]

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

推荐PyPI第三方库


热门话题
java如何在jetty请求日志中添加milliscond字段?   java在使用Scanner类从文件读取信息时遇到问题   为什么。类不适用于泛型类型?   SQLite插入上的java空指针异常   java能告诉我们Guava缓存是在禁用统计数据的情况下构建的吗?   java在应用程序中使用常量   java无法使用AutoIT和Selenium Webdriver在所需位置/文件夹保存图像   java如何在jtable中更新jprogress栏   java是比较给定日期和当前日期(在给定时区中没有时间段)的最佳方法   安卓代码中的java错误   java无法访问实体类中的字段   java如何在tomcat中处理三个JDBC连接池?   java无法使用Spring Security保护AngularJS页面   如何在没有TCP/IP协议栈的情况下用Java发送以太帧