国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

推薦11個實用Python庫

2019-11-25 18:01:28
字體:
來源:轉載
供稿:網友

1) delorean

非常酷的日期/時間庫

復制代碼 代碼如下:

from delorean import Delorean
EST = "US/Eastern"
d = Delorean(timezone=EST)

2) prettytable

可以在瀏覽器或終端構建很不錯的輸出

復制代碼 代碼如下:

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

非常瘦小的語言轉換庫,支持15種語言

復制代碼 代碼如下:

from snowballstemmer import EnglishStemmer, SpanishStemmer
EnglishStemmer().stemWord("Gregory")
# Gregori
SpanishStemmer().stemWord("amarillo")
# amarill

4) wget

Python的網絡爬蟲庫

復制代碼 代碼如下:

import wget
wget.download("
# 100% [............................................................................] 280385 / 280385

5) PyMC

PyMC,一個用于貝葉斯分析的函數庫

復制代碼 代碼如下:

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命令作為函數導入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

如其名,一個滾動條函數庫

復制代碼 代碼如下:

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

一個可以產生唯一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庫,希望大家能夠喜歡。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 荃湾区| 元氏县| 鹤峰县| 盖州市| 东乡县| 潼南县| 马山县| 宽甸| 修武县| 呼图壁县| 通州市| 衡阳市| 安阳市| 正阳县| 贵德县| 清河县| 井陉县| 洱源县| 涪陵区| 泉州市| 前郭尔| 五大连池市| 栾川县| 竹北市| 新田县| 阜康市| 津市市| 浠水县| 阳信县| 武山县| 华阴市| 花垣县| 修水县| 夏津县| 邯郸县| 宜昌市| 桃源县| 仁化县| 德州市| 瓮安县| 石景山区|