11 Useful Python Libraries recommended

Source: Internet
Author: User
1) DeLorean

Very cool date/Time library

Copy the 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 the 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 skinny Language Conversion library, supported in 15 languages

Copy the 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 the Code code as follows:


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

5) PYMC

PYMC, a library of functions for Bayesian analysis

Copy the 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

Import a shell command as a function into a Python script

Copy the 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

Used for string match rate, token match, etc.

Copy the Code code as follows:


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

8) ProgressBar

As its name, a scroll bar function library

Copy the 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 lets you add rich colors to your text

) UUID

A library that can produce a unique UUID

Copy the Code code as follows:


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

One) Bashplotlib

A Python Drawing Control that allows you to draw histograms, scatter plots, and more.

Copy the Code code as follows:


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

The above is the recommended 11 use of the Python library, perhaps some you have not seen, but are some very good 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.