【Python】通過xlwt模組使用表格
def create_table(keyword):
## 建立表格名稱
if '%' in keyword:
keyword.replace('%','+')
tableName = 'zhihu-' + keyword + '.xls'
wt_book = xlwt.Workbook(encoding = 'utf-8', style_compression = 0)
sheet = wt_book.add_sheet(keyword, cell_overwrite_ok = True)
## 表格樣式
for i in range (5):
sheet.col(i).width = 2000 + 10000*i
fnt = xlwt.Font()
fnt.bold = True
alig_center = xlwt.Alignment()
alig_center.horz = xlwt.Alignment.HORZ_CENTER
style = xlwt.XFStyle()
style.font = fnt
style.alignment = alig_center
sheet.write(0,0,"Nid",style)
sheet.write(0,1,"Title",style)
sheet.write(0,2,"Summary",style)
sheet.write(0,3,"Content",style)
sheet.write(0,4,"Url",style)
wt_book.save(tableName)
return sheet,wt_book,tableName
相關文章
- 通過TEB遍歷程式模組
- python 多程式通訊模組Python
- node表格模組exceljs介紹1–基本使用ExcelJS
- 通過git安裝npm私有模組GitNPM
- Python非同步通訊模組asynchatPython非同步
- Python非同步通訊模組asyncorePython非同步
- Nginx通過geo模組設定白名單Nginx
- python常識系列07-->python利用xlwt寫入excel檔案PythonExcel
- Python開發技巧-使用Python生成HTML表格PythonHTML
- Swoole 中通過 process 模組實現多程式
- Android 通過 APT 解耦模組依賴AndroidAPT解耦
- Python表格處理模組xlrd在Anaconda中的安裝Python
- Python中模組的使用Python
- 移遠 EC20 模組(4G通訊模組)AT指令測試 TCP 通訊過程TCP
- 怎麼通過Python掙外快,通過Python掙外快的幾種方式!Python
- 理解TCP/IP、UDP - 通過nodejs的net模組TCPUDPNodeJS
- Python實踐:模組自動過載Python
- Python 中argparse模組的使用Python
- python random隨機模組使用Pythonrandom隨機
- python—time模組使用詳解Python
- python—random模組使用詳解Pythonrandom
- 關於python操作excel,xlwt,xlwd,最簡單的操作介紹PythonExcel
- 如何使用 Python 通過 Tor 瀏覽器發出請求Python瀏覽器
- 通過專案梳理vuex模組化 與vue元件管理Vue元件
- rpm安裝的php 通過編譯增加模組PHP編譯
- Nginx通過內建的Perl模組執行Perl程式Nginx
- [Office] WPS Excel通過新增巨集實現多張表格合併Excel
- 在Go和Python之間通過ActiveMQ通訊GoPythonMQ
- python3 通過 pybind11 使用Eigen加速程式碼Python
- 如何使用python計數模組counter?Python
- 【python基礎】os模組的使用Python
- python inspect模組簡單使用Python
- python非同步asyncio模組的使用Python非同步
- python—hashlib模組使用詳解Python
- Python之Requests模組使用詳解Python
- Python logging 模組使用Python
- 安利:pynlpir, nlpir 的python端介面, 通過python 使用nlpir / ictclas 2015Python
- 優雅通過HttpClientFactory使用HttpClientHTTPclient