Parsing comments in dot file using python

I use pydot to parse point files in python. I can’t find a way to parse the comments present in the points file itself, is there any way to do this?

Just looking at the documentation, I did not find the answer.

Also, would you suggest a more efficient parser for point files (perhaps better supported) than pydot?

thanks

+1
source share
1 answer

maybe if you use the json module with it, for example:

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'] 
0
source

Source: https://habr.com/ru/post/981957/


All Articles