My code is follow the class of machine learning of google.The two code are same.I don\'t know why it show error.May be the type of variable is error.But google\'s code is sa
pydot.graph_from_dot_data() returns a list, so try:
pydot.graph_from_dot_data()
graph = pydot.graph_from_dot_data(dot_data.getvalue()) graph[0].write_pdf("iris.pdf")