如何使用python3编写excel?

如何使用python3编写excel?,excel,python-3.x,Excel,Python 3.x,如何使用python3编写excel 如何将2个值写入第一列A,将其他2个值写入列B,将其他2个值写入列c,就像这样,直到行结束 listoflist=[["data1$","data2$"],["content1","content2"],["first","second"]] for i,string in enumerate(listoflist): for j in string: replaced = re.sub("[^a-zA

如何使用python3编写excel

如何将2个值写入第一列A,将其他2个值写入列B,将其他2个值写入列c,就像这样,直到行结束

  listoflist=[["data1$","data2$"],["content1","content2"],["first","second"]]

   for i,string in enumerate(listoflist):
          for j in string:
            replaced = re.sub("[^a-zA-Z0-9/.' ]+", '', j)
            print(replaced)
             column_count = 2
def excel_file():

     new_row_data =[["heading"],[replaced]]
     workbook = xlsxwriter.Workbook('Input.xlsx')
     workbook.close()

      wb = load_workbook("Input.xlsx")
      ws = wb.worksheets[0]

      for row_data in new_row_data:
               ws.append(row_data)

      wb.save("table.xlsx") 
      print("Please Open the Excel File")


excel_file()
预期输出:希望在excel文件中输出

  Column A      Column B        Column c
  data1         content1        first
  data2         content2        second

我相信pandas库中有一个函数可以使打开excel变得简单。谢谢,但我如何将值拆分为2来编写我不确定,但您可以签出