importxlrdimportmatplotlib.pyplotaspltimportnumpyasnpimportosimporttimedefread_excel():print(os.getcwd())workbook=xlrd.open_workbook('1.xlsx')#打开excel文件sheet=workbook...
import xlrdimport matplotlib.pyplot as pltimport numpy as npimport osimport timedef read_excel(): print(os.getcwd()) workbook = xlrd.open_workbook('1.xlsx') # 打开excel文件 sheet = workbook.sheet_by_name("1") # 打开sheet1 row_num = sheet.nrows #获取行数 row_list = [] plt.ion() plt.figure(1) for i in range(1, row_num): row_data = sheet.row_values(i) # 获得第i行的数据 for data in row_data: if data != '': row_list.append(data) # print(row_list) plt.clf() plt.plot(row_list) plt.pause(0.1) plt.ioff() return sorted(row_list)if __name__ == '__main__': read_excel()
展开