Python Excel Multiple sheet multiple data custom write

Source: Internet
Author: User

Pip Install XLWT

Python Excel data write operations, processing Web site data export and not too much data Crawler storage, the use of a lot of wheels.

(150+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=)

1 #Coding:utf-82 ImportXLWT3  fromXlwtImportWorkbook4 5 6WB =Workbook ()7WS = Wb.add_sheet ('Product')8Ws_1 = Wb.add_sheet (' Other')9 TenFontSize = XLWT.EASYXF ('font:height, name Calibri; Align:horiz Center;')#Font Customization One  ARow0 = [u'Nominal', u'links', u'Notes'] -Row1 = [u'name', u'file', u'URL'] -  the defTitle_write (ROW,WS): -     #Generate title -      forIinchRange (0,len (row)): -Col =Ws.col (i) +Col.width=256*18 -             ifi = = (len (row)-1): +Ws.col (i). width = 256*23 AWs.write (0,I,ROW[I],XLWT.EASYXF ('font:height, name Arial_unicode_ms, Colour_index Black, bold On;align:horiz center;')) at  - title_write (ROW0,WS) - title_write (row1,ws_1) -  -data = [{'1': [u'The detective of Sherlock Holmes collection', u'http://www.fuermositanan.com/', u'Reasoning'],'2': [u'The Sherlock Holmes stories', u'Arthur Conan Doyle', u'https://ebooks.adelaide.edu.au/d/doyle/arthur_conan/']}]#here the demo is dead and changed according to the actual needs -  inx = 1 -  forIinchData: toRows_0 = i['1'] +Rows_1 = i['2'] -     defRows_write (CONTENT,WS): the         #Generate Content *          forNum,rowsinchEnumerate (content): $RowsifRows! = NoneElse "'Panax Notoginseng ws.write (x, num, rows, fontSize) - rows_write (ROWS_0,WS) the rows_write (rows_1,ws_1) +x + = 1 A  theFname='Books.xls' +Wb.save (fname)

Python Excel Multiple sheet multiple data custom write

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.