對於一個已存在的Excel表,怎麼將一條新記錄寫到這個Excel表?
原先Python2.7是先打開Excel表,後復制表,獲取sheet,讀取rows,在第rows+1行寫入數據,然後保存
#讀取xls,
r_xls = ExcelRead.open_workbook('test.xls')
r_sheet = r_xls.sheet_by_index(0)
rows = r_sheet.nrows
w_xls = copy(r_xls)
sheet = w_xls.get_sheet(0)
sheet.write(rows, 0, "test")
w_xls.save('test.xls')
到時到了Python3,這個寫法就報錯,求解Python3.4該怎麼寫?
其中Python3.4用的是以下幾個操作表格的庫
from xlutils3.copy import copy
import xlrd
import xlwt
http://www.jb51.net/article/63497.htm