python读取excel的单元格返回类型
Python通过xlrd对Excel进行读取操作时,返回的数据类型(ctype)有下面5中类型:
0 – empty:空
1 – string:字符串
2 – number:数字
3 – date:日期
4 – boolean:布尔
5 – error
import xlrd
import os
from LYKION.self.log import Logger
from datetime import datetime
from xlrd import xldate_as_tuple
'''
python读取excel中单元格的内容返回的5种类型
0 --empty:空
1 --string:字符串
2 --number:数字
3 --date:日期
4 --boolean:布尔
5 --error
'''
excel_path = os.path.join(os.getcwd(), 'extra.xlsx') # Excel文件路径
Logger().info('Excel文件的路径:' + excel_path)
excel_file = xlrd.open_workbook(excel_path) # 打开Excel文件
# table = excel_file.sheet_by_index(1) # 通过索引打开
# table = excel_file.sheet_by_