1) delorean
非??岬娜掌?時間庫
from delorean import Delorean
EST = "US/Eastern"
d = Delorean(timezone=EST)
2) prettytable
可以在瀏覽器或終端構(gòu)建很不錯的輸出
from prettytable import PrettyTable
table = PrettyTable(["animal", "ferocity"])
table.add_row(["wolverine", 100])
table.add_row(["grizzly", 87])
table.add_row(["Rabbit of Caerbannog", 110])
table.add_row(["cat", -1])
table.add_row(["platypus", 23])
table.add_row(["dolphin", 63])
table.add_row(["albatross", 44])
table.sort_key("ferocity")
table.reversesort = True
+----------------------+----------+
|??????? animal??????? | ferocity |
+----------------------+----------+
| Rabbit of Caerbannog |?? 110??? |
|????? wolverine?????? |?? 100??? |
|?????? grizzly??????? |??? 87??? |
|?????? dolphin??????? |??? 63??? |
|????? albatross?????? |??? 44??? |
|?????? platypus?????? |??? 23??? |
|???????? cat????????? |??? -1??? |
+----------------------+----------+
3) snowballstemmer
非常瘦小的語言轉(zhuǎn)換庫,支持15種語言
from snowballstemmer import EnglishStemmer, SpanishStemmer
EnglishStemmer().stemWord("Gregory")
# Gregori
SpanishStemmer().stemWord("amarillo")
# amarill
4) wget
Python的網(wǎng)絡爬蟲庫
import wget
wget.download("
# 100% [............................................................................] 280385 / 280385
5) PyMC
PyMC,一個用于貝葉斯分析的函數(shù)庫
from pymc.examples import disaster_model
from pymc import MCMC
M = MCMC(disaster_model)
M.sample(iter=10000, burn=1000, thin=10)
[-----------------100%-----------------] 10000 of 10000 complete in 1.4 sec
6) sh
將shell命令作為函數(shù)導入Python腳本
from sh import find
find("/tmp")
/tmp/foo
/tmp/foo/file1.json
/tmp/foo/file2.json
/tmp/foo/file3.json
/tmp/foo/bar/file3.json
7) fuzzywuzzy
用于字符串匹配率、令牌匹配等
from fuzzywuzzy import fuzz
fuzz.ratio("Hit me with your best shot", "Hit me with your pet shark")
# 85
8) progressbar
如其名,一個滾動條函數(shù)庫
from progressbar import ProgressBar
import time
pbar = ProgressBar(maxval=10)
for i in range(1, 11):
??? pbar.update(i)
??? time.sleep(1)
?pbar.finish()
# 60% |########################################################????????????????????????????????????? |
9) colorama
一個色彩庫,可以為文本添加豐富的色彩
10) uuid
一個可以產(chǎn)生唯一uuid的庫
import uuid
print uuid.uuid4()
# e7bafa3d-274e-4b0a-b9cc-d898957b4b61
11) bashplotlib
Python的繪圖控件,可以繪制直方圖、散點圖等
$ pip install bashplotlib
$ scatter --file data/texas.txt --pch x
以上就是本文推薦的11個使用的python庫了,也許有些你沒有見過,但都是些非常棒的pyton庫,希望大家能夠喜歡。
更多文章、技術(shù)交流、商務合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
