Python novice learns to use the library

This article mainly introduces how to use third-party libraries.

1. Understand third-party libraries

Python is equivalent to a mobile phone, and third-party libraries are equivalent to various apps in the mobile phone.

When we want to build a website, we can choose web frameworks such as full-featured Django and lightweight Flask; when we want to be a crawler, we can use the Scrapy framework; when we want to do data analysis, we can choose the Pandas data framework, etc. These are some very mature third-party libraries.

So, how do you find the corresponding library according to your needs?

You can find the required libraries by category on https://awesome-python.com.

2. Install third-party libraries

Here we mainly introduce how to install third-party libraries in PyCharm.

1 ) Open PyCharm-top menu File-select Default Settings;

2 ) Search project interpreter, select the current Python environment, and then click the "+" sign at the bottom to add a library;

3 ) Search the database name-select the library and click Install Package at the bottom. After the installation is successful, a successful prompt will appear. At this time, you can return to the previous Project Interpreter to view the library you installed. Click the "-" sign to uninstall it. The required library.

3. Use third-party libraries

When using a third-party library, you can use it as long as you enter the library in PyCharm. Use import for the input library. For example, input the requests library as: import requests.

The basic knowledge about Python in the first stage is roughly here, and the sharing in the second stage will be mainly on Python crawlers.

Knowledge point supplement:

Examples of library usage:

jieba library

Installation: pip install jieba

Chinese word segmentation

Use a Chinese thesaurus to determine the correlation probability between Chinese characters

Chinese characters are formed into phrases with high probability to form word segmentation results. In addition to word segmentation, users can also add custom phrases (such as names or proper nouns such as Sima Xiangru, etc.)

Three modes

  1. Accurate mode: cut the text accurately, without redundant words
  2. Full mode: Scan all possible words in the text, with redundancy
  3. Search engine mode: Based on the precise mode, segment long words again

jieba.lcut(s) precise mode, returns a list type word segmentation result
jieba.lcut("China is a great country")
[' China','is','one','great','of','country']

This is the end of this article about learning to use libraries for python novices. For more relevant python how to use the library, please search the previous articles of ZaLou.Cn or continue to browse the related articles below. Hope you will support ZaLou.Cn more in the future!

Recommended Posts

Python novice learns to use the library
Python novice learns to raise usage
How to use the round function in python
How to use the zip function in Python
How to use the format function in python
Use python to realize the aircraft war game
How to use python tuples
How to use python thread pool
Use python to query Oracle database
Use C++ to write Python3 extensions
How to save the python program
How to view the python module
How to use SQLite in Python
How to use and and or in Python
Use Python to make airplane war games
Python string to judge the password strength
How to use PYTHON to crawl news articles
Python | So collections are so easy to use! !
Use Python to generate Douyin character videos!
The essence of Python language: Itertools library
Use Python to quickly cut out images
How to learn the Python time module
Use python3 to install third on ubuntu
The specific method of python import library
Detailed explanation of the use of pip in Python | summary of third-party library installation
Dry goods | Use Python to operate mysql database
Use the command to solve the Ubuntu projector problem:
An article to understand the yield in Python
01. Introduction to Python
How to use code running assistant in python
How to enter python through the command line
Python crawler-beautifulsoup use
2.1 The Python Interpreter (python interpreter)
How to switch the hosts file using python
Use python to realize business card management system
How to install the downloaded module in python
Introduction to the use of Hanlp in ubuntu
Python how to move the code collectively right
The best way to judge the type in Python
Introduction to Python
Use the command line to detect the Ubuntu version method
How to practice after the python file is written
What are the methods for python to connect to mysql
How to understand the introduction of packages in Python
How to avoid running away when deleting the library
Using Python to analyze the Guangzhou real estate market
The specific steps to upgrade python on Raspberry Pi
Python simulation to realize the distribution of playing cards
What are the ways to open files in python
Python uses the re module to verify dangerous characters
Centos 6.4 python 2.6 upgrade to 2.7
Python3 external module use
Consolidate the Python foundation (2)
How to find the area of a circle in python
Minimalism is the soul of Python | Python code to find bugs (10)
Quick Start Web Crawler Series Chapter08 | Use Python library extraction
Linux overview of Python automated operation and maintenance and the ultimate guide to virtual machine installation and use