示例
import xlrd from tqdm import tqdm readbook= xlrd.open_workbook("./情感分析.xlsx") reviews = open("3分类情感分析.txt","a",encoding="utf-8") #通过表的索引号读取表格 sheet = readbook.sheet_by_index(0) #行数 nrows = sheet.nrows #列数 ncols = sheet.ncols bar = tqdm(range(nrows),total=nrows) for i in bar: # print() reviews.write(sheet.cell_value(i,0)+" ")