我想将一个点文件加载到python,使用这个
graph = pydot.graph_from_dot_file(tmp1)
nodeList = graph.get_node_list()
但是当点文件中的节点标签如下时出现错误:
第398章
错误信息是这样的:
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'
似乎转义字符"\"
会导致错误。
"\"
如果我用 替换节点的标签""
,错误就会消失。