Python 输出到excel

使用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)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 13,394评论 0 23
  • 上一篇学习的UITableView的创建和基础使用,当然这只是单机而已,下面我们来学习联网,额!貌似学习的有点跳,...
    繁华乱世沧桑了谁的容颜阅读 4,758评论 0 2
  • property fixed absolute relative fixed 当页面内容过多滚动时,它的位置也不会...
    c59ffede9db6阅读 1,222评论 0 0
  • 这是今天的英文空心字作业,其实之前心里想了好几个创意:mooncake;family tree等等。但是最后还是选...
    lilycat阅读 1,534评论 0 0
  • 对于如何你能买到年化百分之二十,百分之三十以上收益的股票,这个是能力的问题,除了不断去磨练与提升我们的能力外,其实...
    辉灵有道阅读 1,930评论 0 0