11 practical Python libraries are recommended

Source: Internet
Author: User
Tags python web crawler
This article mainly recommends 11 practical Python libraries, all of which have a good mass base and are very useful and practical. we recommend them to you. 1) delorean

Very cool date/time Library

The code is as follows:


From delorean import Delorean
EST = "US/Eastern"
D = Delorean (timezone = EST)

2) prettytable

You can build a good output in a browser or terminal.

The code is as follows:


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 (["doldolphin", 63])
Table. add_row (["albatross", 44])
Table. sort_key ("ferocity ")
Table. reversesort = True
+ ---------------------- + ---------- +
| Animal | ferocity |
+ ---------------------- + ---------- +
| Rabbit of Caerbannog | 110 |
| Maid | 100 |
| Grizzly | 87 |
| Doldolphin | 63 |
| Albatross | 44 |
| Platypus | 23 |
| Cat |-1 |
+ ---------------------- + ---------- +

3) snowballstemmer

Very small language conversion Library, supports 15 languages

The code is as follows:


From snowballstemmer import EnglishStemmer, SpanishStemmer
EnglishStemmer (). stemWord ("Gregory ")
# Gregori
SpanishStemmer (). stemWord ("amarillo ")
# Amarill

4) wget

Python web crawler Library

The code is as follows:


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

5) PyMC

PyMC, a function library for Bayesian Analysis

The code is as follows:


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

Use shell commands as functions to import Python scripts

The code is as follows:


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) fuzzywu.pdf

Used for string matching rate, token matching, etc.

The code is as follows:


From fuzzywuw.import fuzz
Fuzz. ratio ("Hit me with your best shot", "Hit me with your pet shark ")
#85

8) progressbar

As its name is, a function library of the scroll bar

The code is as follows:


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

A color library that can add rich colors to text

10) uuid

A database that can generate a unique uuid

The code is as follows:


Import uuid
Print uuid. uuid4 ()
# E7bafa3d-274e-4b0a-b9cc-d898957b4b61

11) bashplotlib

Python plotting control, which can draw histograms, scatter plots, etc.

The code is as follows:


$ Pip install bashplotlib
$ Scatter -- file data/texas.txt -- pch x

The above are the 11 python libraries recommended in this article. you may not have seen them, but they are all very good pyton libraries. I hope you will like them.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.