我想将一个点文件加载到python,使用这个
graph = pydot.graph_from_dot_file(tmp1)
nodeList = graph.get_node_list()
但是当dot文件中节点的标签如下所示时,我得到了错误:
398 [shape=diamond, fillcolor="#CCCCCC", label="(int)*value == '\\"'"];
错误消息如下:
398 [shape=diamond, fillcolor="#CCCCCC", label="(int)*value == '\\\"'"]; ^ Expected "}" (at char 1800), (line:34, col:7) Traceback (most recent call last): File "dotchange.py", line 52, in <module> print dotchange(line) File "dotchange.py", line 13, in dotchange nodeList = graph.get_node_list() AttributeError: 'NoneType' object has no attribute 'get_node_list'
似乎转义符"\"
导致了错误。在
如果我将包含"\"
的节点的标签替换为""
,错误就会消失。在
目前没有回答
相关问题 更多 >
编程相关推荐