sswyt,常熟旅游网,快眼看书凡人修仙传
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库,希望大家能够喜欢。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
python如何查看网页代码
用python查看网页代码的方法:1、使用“import”导入requests包import requests2、使用requests包的get()函数通过网页...
[阅读全文]
-
-
python如何保存文本文件
python保存文本文件的方法:使用python内置的open()类可以打开文本文件,向文件里面写入数据可以用write()函数,写完之后,使用close()函...
[阅读全文]
-
python如何编写win程序
python可以编写win程序。win程序的格式是exe,下面我们就来看一下使用python编写exe程序的方法。编写好python程序后py2exe模块即可将...
[阅读全文]
-
-
-
-
-
-
网友评论