推薦11個(gè)實(shí)用Python庫(kù)
1) delorean
非??岬娜掌?時(shí)間庫(kù)
from delorean import Delorean
EST = "US/Eastern"
d = Delorean(timezone=EST)
2) prettytable
可以在瀏覽器或終端構(gòu)建很不錯(cuò)的輸出
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
非常瘦小的語(yǔ)言轉(zhuǎn)換庫(kù),支持15種語(yǔ)言
from snowballstemmer import EnglishStemmer, SpanishStemmer
EnglishStemmer().stemWord("Gregory")
# Gregori
SpanishStemmer().stemWord("amarillo")
# amarill
4) wget
Python的網(wǎng)絡(luò)爬蟲(chóng)庫(kù)
import wget
wget.download("
# 100% [............................................................................] 280385 / 280385
5) PyMC
PyMC,一個(gè)用于貝葉斯分析的函數(shù)庫(kù)
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ù)導(dǎo)入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
如其名,一個(gè)滾動(dòng)條函數(shù)庫(kù)
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
一個(gè)色彩庫(kù),可以為文本添加豐富的色彩
10) uuid
一個(gè)可以產(chǎn)生唯一uuid的庫(kù)
import uuid
print uuid.uuid4()
# e7bafa3d-274e-4b0a-b9cc-d898957b4b61
11) bashplotlib
Python的繪圖控件,可以繪制直方圖、散點(diǎn)圖等
$ pip install bashplotlib
$ scatter --file data/texas.txt --pch x
以上就是本文推薦的11個(gè)使用的python庫(kù)了,也許有些你沒(méi)有見(jiàn)過(guò),但都是些非常棒的pyton庫(kù),希望大家能夠喜歡。
相關(guān)文章
Python中selenium實(shí)現(xiàn)文件上傳所有方法整理總結(jié)
本篇文章主要介紹了Python中selenium實(shí)現(xiàn)文件上傳所有方法整理總結(jié),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。2017-04-04PyCharm之如何設(shè)置自動(dòng)換行問(wèn)題
這篇文章主要介紹了PyCharm之如何設(shè)置自動(dòng)換行問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-05-05Python 基于wxpy庫(kù)實(shí)現(xiàn)微信添加好友功能(簡(jiǎn)潔)
這篇文章主要介紹了Python 基于wxpy庫(kù)實(shí)現(xiàn)微信添加好友功能,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-11-11PHP webshell檢查工具 python實(shí)現(xiàn)代碼
Web安全應(yīng)急響應(yīng)中,不免要檢查下服務(wù)器上是否被上傳了webshell,手工檢查比較慢,就寫(xiě)了個(gè)腳本來(lái)檢查了。Windows平臺(tái)下已經(jīng)有了lake2寫(xiě)的雷克圖的了,一般的檢查也夠用了,寫(xiě)了個(gè)Linux下面的,用python寫(xiě)的。2009-09-09為什么從Python 3.6開(kāi)始字典有序并效率更高
這篇文章主要給大家介紹了關(guān)于為什么從Python 3.6開(kāi)始字典有序并效率更高的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用Python具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-07-07Python實(shí)現(xiàn)?MK檢驗(yàn)示例代碼
這篇文章主要介紹了Python實(shí)現(xiàn)?MK檢驗(yàn),本文通過(guò)示例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-12-12