import xlrd
efile = xlrd.open_workbook(r"C:\Users\Administrator\Desktop\ip地址信息表.xlsx")
sheetfile = efile.sheet_by_name('Sheet1')
print(sheetfile.row_values(0))
for i in range(1, sheetfile.ncols):
print(sheetfile.row_values(i)[4])
print(sheetfile.row_values(i)[3])
print(int(sheetfile.row_values(i)[2]))
print(sheetfile.row_values(i)[1])
print(sheetfile.row_values(i)[0])
import datetime
import time
from openpyxl import Workbook
wb = Workbook()
ws = wb.active
ws['A1'] = 42
ws['B1'] = '你好' + 'automation test'
ws.append([1, 2, 3])
ws['A2'] = datetime.datetime.now()
ws['A3'] = time.strftime("%Y{y}%m{m}%d{d} %H{h}%M{f}%S{s}").format(y="年", m="月", d="日", h="时", f="分", s="秒")
wb.save(r"C:\Users\Administrator\Desktop\test1.xlsx")