The most comprehensive collection of essential Python basic knowledge on the website, you will be employed immediately after learning it! [It is recommended to collect and study carefully]_Complete basic knowledge of python

Foreword:

Python is the most popular programming language in the 21st century. There are various learning videos on the market in an endless stream, and the learning atmosphere about Python is gradually getting stronger! ! Recently, more and more friends have sent me private messages, hoping that I would publish a basic introduction to Python. After working hard for N hours, I finally compiled this "Essential Knowledge for Basic Introduction to Python"!

1. Identifier

Identifiers are names used in programming. They are used to name variables, functions, statement blocks, etc. In Python, identifiers are composed of letters, numbers, and underscores. They cannot start with numbers and are case-sensitive.

Identifiers starting with an underscore have special meanings. Identifiers starting with a single underscore, such as: _xxx, indicate class attributes that cannot be accessed directly. They need to be accessed through the interface provided by the class and cannot be imported with from xxx import *; identifiers starting with a double underscore Identifiers, such as: __xx, represent private members; identifiers starting and ending with double underscores, such as: xx , represent built-in identifiers in Python, such as: init () represents the constructor of a class.

2. Keywords

Insert image description here

The above table is keywords (reserved words) in Python. We cannot use keywords when customizing identifiers.

3. Quotation marks

Python can use quotation marks ('), double quotation marks ("), and triple quotation marks (''' or """) to represent strings. The beginning and end of the quotation marks must be of the same type. Triple quotation marks can be composed of multiple lines. As follows:

id = '001'

name = "张三"

skill = '''
唱歌
跳舞'''

skill = """
唱歌
跳舞"""

4. Encoding

The default encoding in Python2 is ASCII. If the content is Chinese characters, it cannot be output and read correctly without specifying the encoding. For example, if we want to specify the encoding as UTF-8, in Python, we can add # at the beginning - - coding: UTF-8 - - Make the designation.

The default encoding in Python3 is UTF-8, so when using Python3, we usually do not need to specify the encoding.

5. Input and output

Python output uses print(), and the content is added in parentheses. As follows:

print('Hello Python')、

Python provides an input() that allows users to enter a string and store it in a variable. As follows:

name = input()
print('Hi',name)

6. Indentation

Python does not use {} to control classes, functions, logical judgments, etc., but uses indentation, and the indentation spaces are variable. As follows:

if True:
    print(True)
else:
    print(False)

7. Multiple lines

In Python, a new line is generally used as the end mark of a statement. You can use \ to divide a line of statements into multiple lines for display. As follows:

a = 128
b = 1024
c = 512
d = a + \
    b - \
    c

If enclosed in [], {}, () brackets, you do not need to use \. As follows:

arr = {
    a,
    b,
    c
}

8. Comments

In Python, single-line comments use #, and multi-line comments use three single quotes (''') or three double quotes ("""). As shown below:

# 我是单行注释

'''
我是多行注释
我是多行注释
'''

"""
我是多行注释
我是多行注释
"""

9. Data type

  • Integer : can be of any size, including negative numbers
  • Floating point numbers : decimals
  • String : text enclosed in single quotes ', double quotes ", triple quotes ''' or """
  • Boolean : only two values: True and False
  • Empty value : represented by None
  • Variable : is mutable
  • Constant : immutable

10. Operator

10.1 Common operators

Insert image description here

10.2 Operator precedence

Insert image description here

Base

Python basics (2): basic statements

Python basics (3): I am a number

Python Basics (4): Strings

Python Basics (5): Sequence

Python Basics (6): Lists and Tuples

Python Basics (7): Dictionaries and Collections

Python basics (8): time-related modules

Python Basics (9): Functions

Python Basics (10): Modules and Packages

Python Basics (11): Object Oriented

Python basics (12): basic file operations

Python basics (13): os module

Python Basics (14): Errors and Exceptions

Python Basics (15): Enumeration

Python Basics (16): Iterators and Generators

Python Basics (17): Decorators

Python Basics (18): Namespace & Scope

Python Basics (19): Mathematics-related modules

Python basics (20): sys module

Python basics (21): argparse module

Python basics (22): regular expressions

Advanced

Python Advanced (1): Multithreading

Python Advanced (2): Multi-process

Python Advanced (3): Sending and Receiving Emails

Python Advanced (4): MySQL for Database Operations

Python Advanced (5): SQLite for Database Operations

Python Advanced (6): Basic Excel Operations

Python Advanced (7): Basic Word Operations

Python Advanced (8): Basic XML Operations

Python Advanced (9): Basic JSON Operations

Python Advanced (10): Network Programming

reptile

100+ Python crawler classic practical projects

Python crawler (1): crawler disguise

Python crawler (2): Requests library

Python crawler (3): BeautifulSoup library

Python crawler (4): Selenium framework

Python crawler (5): PyQuery framework

Python crawler (6): Scrapy crawls scenic spot information

Python crawler (7): pyspider usage

Python crawls Zhihu Q&A

Python crawls public account articles

Python crawls the barrage of "Houlang" on station B

Python crawls iQiyi's "Republic of China" barrage

Use Python to crawl all skins of League of Legends (lol)

Python crawls comments on Douban's "The Party at Southern Station"

I used Python to crawl the comment areas of three major dating software, and the result...

Crawling the Weibo comments of Lin Dan and Zhao Yaqi to see what netizens said

automation

Word batch conversion to PDF

Python batch merge Excel

Automation artifact! Python batch reads ID card information and writes it to Excel

Just read this article to get started with Python + Appium automated WeChat operations.

Use Python to automatically grab red envelopes on WeChat. You no longer have to worry about not being able to grab red envelopes.

I used Python to find out all the people who deleted my WeChat and deleted them automatically.

Use Python to automatically collect energy from Ant Forest on a scheduled basis, so you no longer have to worry about forgetting to collect it.

data analysis

Python data analysis (1): basic knowledge of NumPy

Python data analysis (2): Matplotlib drawing

Python data analysis (3): First introduction to Pandas

Python Data Analysis (4): Pandas Advanced

The most complete NumPy tutorial

Python analysis of "Longling Mysterious Cave"

Python draws various epidemic maps

Python data analysis introductory knowledge manual

Pandas Cheat Sheet&Chinese Documentation&Video Tutorial

Use Python to analyze the movie "My Hometown and Me"

2022 Spring Festival movies are released, use Python to find out

Where did your friends hang out on National Day in 2021? Let Python tell you

wlh's melon is huge! I used Python to crawl the Guawen comment area and found it even more exciting.

Write mini games

mine clearance

Snake

tank battle

Airplane war

Happy Xiaoxiaole

Tetris

Plants vs. Zombies

Contra + 30 Python mini-games

Hobby Python

When Python meets WeChat

I fired my boss using Python

Use Python to write a Chinese Valentine's Day confession artifact

Use Python to implement WeChat automatic reply

Download Douyin videos without watermark using Python

Python implements the Matrix code rain effect

Use Python to create cool QR codes and analyze them

Write a beauty test gadget in Python

Send special Mother’s Day wishes using Python

Sao operation | Use Python to implement GIF reverse playback

Draw a funny (funny) expression using Python

Use Python to create an artistic signature gadget

I used Python to draw a plate of rice dumplings for everyone

Use Python to draw a Christmas tree with music on a snowy night

Prepare for 618, use Python to receive JD coupons

Use Python to implement the nine-square grid picture in the circle of friends

Use Python to implement an environmentally friendly and pollution-free fireworks show

Use Python to learn about the most dazzling Chinese comic "Five Elements of Wushan"

It’s almost Chinese New Year, I’ll use Python to write couplets & the character “福” for you

Face-changing function can be implemented in less than 100 lines of Python code

It was my friend’s birthday and I used Python to draw her a birthday cake.

Create beautiful ID photos with less than 20 lines of Python code

Use Python to generate "Happy May Day" from QQ friend avatars

One line of commands to put a mask on Fox Hunter F4 & detect whether it is wearing a mask

Use Python to add a small flag (small mooncake) to your avatar

Are you still worried about 520? Teach you how to write a confession artifact using Python

Documentation & Practical Projects

Python Learning Manual

Python3.10 official document PDF

100+ Python crawler classic practical projects

70 classic and practical Python practice projects (with source code)

Python interview guide PDF (245 Python interview questions)

240 Python practice cases with source code (seeing a hundred times is worse than practicing once)

Python self-study route

Python complete set of study notes (getting started + crawler + visualization & data analysis + machine learning + deep learning)

This complete version of the complete set of Python learning materials has been uploaded to CSDN. If you need it, friends can scan the CSDN official certification QR code below on WeChat to get it for free [ 保证100%免费]

Insert image description here

Guess you like

Origin blog.csdn.net/weixin_49895216/article/details/132995037