我必须从这段代码中得到一个图形,但似乎有些东西不能用它。
当我运行代码时,我得到了这个:
ValueError: invalid literal for int() with base 10: ''
这是代码:
import matplotlib.pyplot as plt
x=[]
y=[]
readFile = open("C:/Users/Martinez/Documents/Diego/Python/SampleData.txt","r")
for linea in readFile:
print linea
sepFile = readFile.read().split("\n")
readFile.close()
for plotPair in sepFile:
xAndY = plotPair.split(',')
x.append(int(xAndY[0]))
y.append(int(xAndY[1]))
print x
print y