Recommended 11 Practical Python libraries _python

Source: Internet
Author: User
Tags uuid python script

1) DeLorean

Very cool date/Time library

Copy Code code as follows:

From DeLorean import DeLorean
EST = "Us/eastern"
D = DeLorean (Timezone=est)

2) prettytable

Good output can be built in a browser or terminal

Copy Code code 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 (["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

Very thin Language conversion library that supports 15 languages

Copy Code code as follows:

From Snowballstemmer import Englishstemmer, Spanishstemmer
Englishstemmer (). Stemword ("Gregory")
# Gregori
Spanishstemmer (). Stemword ("Amarillo")
# Amarill

4) wget

Python's web crawler Library

Copy Code code as follows:

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

5) PYMC

PYMC, a function library for Bayesian analysis

Copy Code code 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

To import a shell command as a function into a Python script

Copy Code code 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) Fuzzywuzzy

For string matching rates, token matching, etc.

Copy Code code as follows:

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

8) ProgressBar

As its name, a scroll bar function library

Copy Code code 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 the text

) UUID

A library that can produce a unique UUID

Copy Code code as follows:

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

One) Bashplotlib

Python's drawing controls, you can draw histograms, scatter graphs, and so on

Copy Code code as follows:

$ pip Install Bashplotlib
$ scatter--file data/texas.txt--pch x

This is the recommended 11 Python libraries, perhaps some you have not seen, but are some of the great Pyton Library, I hope you can enjoy.

Related Article

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.