天天看點

在python中建立excel并寫入

import openpyxl
def write():
    data = openpyxl.Workbook()
    data.create_sheet("sheet1")
    table = data.active
    table.cell(1,1,"time")
    table.cell(1,2,"inoctet")
    table.cell(1,3,"outoctet")
    table.cell(1,4,"port")
    data.save("./excel_test.xlsx")