使用xlsxwrite包
save_path ='C:\\Users\\yangergou\\Desktop\\code\\toutiao_news.xlsx'
wk = xlsxwriter.Workbook(save_path)
sheet = wk.add_worksheet('news')
title = ['title','media_name','categories','keywords','item_id','article_url','gallary_image_count'
,'comment_count','has_image','has_video','hot']
sheet.write_row('A1',title)
# write_column(r,c,content) r: 按列写入的开始行;c: 按列写入的写入列;content : 写入的内容(list)
sheet.write_column(1,0,title)
sheet.write_column(1,1,media_name)
sheet.write_column(1,2,categories)
sheet.write_column(1,3,keywords)
sheet.write_column(1,4,item_id)
sheet.write_column(1,5,article_url)
sheet.write_column(1,6,gallary_image_count)
sheet.write_column(1,7,comment_count)