1. 程式人生 > >用python實現讀取xml文件內容

用python實現讀取xml文件內容

import xlrd

filePath = "E:\\python.xlsx"
worksheet = xlrd.open_workbook(filePath)
sheet_names = worksheet.sheet_names()
for sh_name in sheet_names:
    sheet = worksheet.sheet_by_name(sh_name)

    mRows = sheet.nrows
    mCols = sheet.ncols
    print("-------------------------------" + sh_name + "-------------------------------"
) for i in range(mRows): for j in range(mCols): print("座標(", i, ",", j, ")對應值是:", sheet.row_values(i)[j])