我的代码
from graphviz import Digraph
import re
data=['auohsdrdr03.oracleoutsourcing.com:adc15stor19-nas.us.oracle.com:2049:Outbound', 'auohsdrdr03.oracleoutsourcing.com:adc08stor13-bkp.us.oracle.com:2049:Outbound', 'auohsdrdr03.oracleoutsourcing.com:auohsdrdr01.oracleoutsourcing.com:10510:Outbound', 'auohsdrdr03.oracleoutsourcing.com:bigip-puppet-m-a-adc-oracleoutsourcing.oracle.com:61613:Outbound', 'auohsdrdr03.oracleoutsourcing.com:adc08ldap.oracle.com:389:Outbound', 'auohsdrdr03.oracleoutsourcing.com:adc15stor20-nas.us.oracle.com:2049:Outbound', '10.39.50.62:auohsdrdr03.oracleoutsourcing.com:22:Inbound']
print(data[0])
#list3 = (re.split('[:]',data[0]))
#print(list3[0])
len_data=len(data)
#print(len_data)
dot = Digraph(comment='the io')
a=len_data
print(len_data)
i=0
for i in range(0,len_data-1):
list3 = (re.split('[:]',data[i]))
ob1=list3[0]
ob2=list3[1]
dot.node(str(i), ob1)
dot.node(str(a), ob2)
dot.edges([str(i)+str(a)])
print(i)
a=a+1
if i == len_data-1:
dot.render('test-output/round-table.gv', view=True)
所以我希望在一个pdf文件中显示7个图形连接。但是我收到了这个错误:
runfile('C:/Users/surlal/.spyder/trial_files/w1.py',wdir ='C:/Users/surlal/.spyder/trial_files') auohsdrdr03.oracleoutsourcing.com:adc15stor19-nas.us.oracle.com:2049:Outbound 7 0 1 2 回溯(最近一次调用最后一次):
文件“”,第1行,in runfile('C:/Users/surlal/.spyder/trial_files/w1.py',wdir ='C:/Users/surlal/.spyder/trial_files')
文件“c:\ users \ surlal \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ spyder \ utils \ site \ sitecustomize.py”,第705行,在runfile中 execfile(filename,namespace)
文件“c:\ users \ surlal \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ spyder \ utils \ site \ sitecustomize.py”,第102行,在execfile中 exec(compile(f.read(),filename,'exec'),namespace)
文件“C:/Users/surlal/.spyder/trial_files/w1.py”,第21行,in dot.edges([STR(ⅰ)+ STR(A)])
文件“c:\ users \ surlal \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ graphviz \ dot.py”,第159行,边缘 self.body.extend(线)
文件“c:\ users \ surlal \ appdata \ local \ programs \ python \ python36 \ lib \ site-packages \ graphviz \ dot.py”,第158行, lines =(edge%(quote(t),quote(h))for t,h in tail_head_iter)
ValueError:解压缩的值太多(预期2)