Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用pydot来解析 python 中的点文件。我找不到解析点文件本身中存在的注释的方法,有什么办法吗?
通过仅查看文档,我找不到任何答案。
另外,您会建议比pydot更好的点文件解析器(也许维护得更好)吗?
谢谢
如果您将模块 json 与它一起使用,则有可能:
import pydot import pyparsing import json graph = pydot.graph_from_dot_file(path) edgeList = graph.get_edge_list() for e in edgeList: tempAttr = json.dumps(e.get_attributes()) edgeAttr = json.loads(tempAttr) edgeAttr['insert_label_here']