【发布时间】:2018-12-16 21:14:49
【问题描述】:
有谁知道如何将Digraph 转换为io.StringIO png 的技巧?我能找到的唯一代码是将它保存到磁盘,但我想省略任何磁盘使用情况,而是在内存中处理它:
from graphviz import Digraph
import io
dot = Digraph(comment='The Round Table')
dot.node('A', 'King Arthur')
# instead of this...
dot.render('test-output/round-table.gv', view=True)
# ... I need something like this:
data = io.StringIO()
dot.export_to_png(dot)
【问题讨论】:
标签: python python-3.x graphviz image-graphviz