我最近一直在尝试使用Python包装器构建洋葱刮刀的tutorial。自从编写本教程以来,Onionscan已经从将所有数据存储在JSON文件中转变为将其中一些数据存储在使用Tiedot构建的数据库中。在
我试图找到一种方法来获取一个没有扩展名的文件,简单地命名为dat_0
,并使用Python解析它。在
在macOS Textedit中查看dat_0
,我得到以下信息。。。
我一直在尝试如何使用Python解析这个文件。我从Tiedot的文档和Textedit的视图推测它使用JSON结构,但我运气不太好。在
import json
f = open('crawls/dat_0','rb')
data = json.dumps(f.read())
IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.
或者
^{pr2}$有人。。。 a) 知道这个文件是什么吗? b) 知道如何成功地解析它使数据在Python中可用吗?在
对于将来发现这种情况的人,我自己找到了解决办法。我使用Kaitai Struct为Tiedot文件结构创建一个二进制解析器。Kaitai可以为多种语言创建解析器,因此它是一个非常有用的工具
我用来生成解析器的Kaitai结构是。。。在
相关问题 更多 >
编程相关推荐