A comprehensive Python learning repository! Welcome!
这是一个包含了“基础”、“进阶”、“标准库”和“实战”的
python学习仓库
Free Teaching Videos:(最新教学视频-完全免费)
You need to make sure that the git tool has been installed on your computer.
## 1.use git tool
git clone https://github.com/XianZS/PythonLearning
## 2.Configuration Environment (either-or)
cd PythonLearning
### 2.1 if you use conda
conda env create -f environment.yml
### 2.2 if you use pip
pip install -r requirements.txt
## 3.Export environment
conda env export > environment.yml
pip freeze > requirements.txt
Welcome everyone's participation in the discussion. Thank you.(欢迎各位的交流,谢谢。)
Email:xianzhisen_yang@outlook.com
QQ:3135989009
PythonLearning/
├── Python Basic Learning Section/ [python 基础学习]
│ ├── 1. Getting Started Guide (Icebreaker)
│ ├── 2. Variables and Data Types
│ ├── 3. Operators and Expressions
│ ├── 4. Flow Control (Core Foundation)
│ ├── 5. Function Basics
│ ├── 6. Data Structures (List/Tuple/Dictionary/Set)
│ ├── 7. File Operations
│ ├── 8. Exception Handling
│ └── 9. Basic Comprehensive Practical Project
├── Python Advanced Learning Section/ [python 进阶学习]
│ ├── 1. Advanced Functions
│ ├── 2. Object-Oriented Programming (OOP)
│ ├── 3. Modularization and Package Management
│ ├── 4. Basic Data Processing (Connecting Standard Libraries/Third-Party Libraries)
│ ├── 5. Basic Network Programming
│ ├── 6. Database Programming
│ ├── 7. Introduction to Concurrent Programming
│ ├── 8. Advanced Comprehensive Practical Projects (2 Projects, Covering Multiple Modules)
│ └── 9. Advanced Stage Review and Direction Guidance
└── Python Standard Library Learning Section/ [python 标准库学习]
├── 1. File and Directory Operations
├── 2. Data Processing and Formats
├── 3. System Interaction and Processes
├── 4. Text Processing
├── 5. Date and Time
├── 6. Mathematics and Scientific Computing
├── 7. Concurrency and Asynchrony
├── 8. Debugging and Testing
├── 9. Network Communication
└── 10. Encryption and Security
| Module Order | Core Content |
|---|---|
| 1. Getting Started Guide (Icebreaker) | ① What is Python/What can it do (Visual demonstration of application scenarios such as web crawling, data analysis, automation, etc.); ② Environment Setup (Adapted for Windows/Mac/Linux systems, Anaconda+PyCharm installation, solving the pain point of "installation errors"); ③ First Program (Hello World + personalized modification, such as outputting your own name to enhance sense of involvement) |
| 2. Variables and Data Types | ① Variable Definition (Naming rules + taboos, pitfalls to avoid: Chinese variables, keyword naming); ② Basic Data Types (int/float/str/bool, each type with 2 life-oriented cases: e.g., str for processing names, int for calculating salaries); ③ Type Conversion (Forced conversion + automatic conversion, error-prone point: format issues when converting str to int); ④ Practical Exercise: Record personal information (name, age, salary) and print it |
| 3. Operators and Expressions | ① Arithmetic Operators (+/-/*//%**, cases: calculating shopping discounts, simplified version of salary tax calculation); ② Assignment Operators (=/:=, etc., pitfall to avoid: priority of chained assignment); ③ Comparison Operators (==/!=/>/<, case: judging whether a score is passing); ④ Logical Operators (and/or/not, case: judging whether the condition "adult and having income" is met); ⑤ Practical Exercise: Simple Calculator (implement addition, subtraction, multiplication and division) |
| 4. Flow Control (Core Foundation) | ① if-elif-else (cases: grade classification, leap year judgment); ② for loop (traversing strings/lists, case: batch printing names); ③ while loop (conditional loop, cases: countdown, number guessing game (1-100)); ④ Loop Control (break/continue, pitfall to avoid: indentation issues in nested loops); ⑤ Practical Exercise: Number Guessing Game (add fault tolerance mechanism to prevent crashes when non-numeric input is entered) |
| 5. Function Basics | ① Function Definition and Calling (def keyword, parameters, return values); ② Parameter Types (positional parameters, keyword parameters, default parameters, pitfall to avoid: parameter order); ③ Nested Functions (simple nesting, case: calculating complex formulas); ④ Anonymous Functions (lambda, case: simple calculations); ⑤ Practical Exercise: Encapsulate "score judgment function" and "area calculation function" |
| 6. Data Structures (List/Tuple/Dictionary/Set) | ① List (creation/addition/deletion/modification/query, case: shopping list management); ② Tuple (immutable feature, case: recording ID numbers/coordinates); ③ Dictionary (key-value pairs, case: student information management (name-score)); ④ Set (deduplication/intersection/union, case: filtering duplicate data); ⑤ Pitfalls to avoid: list index out of bounds, immutable dictionary keys; ⑥ Practical Exercise: Student Score Management System (addition/deletion/modification/query) |
| 7. File Operations | ① Opening/Closing Files (open function, with statement, pitfall to avoid: forgetting to close files); ② Text File Reading and Writing (read/readline/write, cases: reading score files, writing logs); ③ Basic CSV File Reading and Writing (case: batch importing student information); ④ Practical Exercise: Write student scores to a CSV file and read it |
| 8. Exception Handling | ① Concept of Exceptions (try-except-finally); ② Common Exceptions (ValueError/TypeError/FileNotFoundError, etc.); ③ Custom Exceptions (simple case); ④ Practical Exercise: Optimize the Number Guessing Game/Calculator (add exception capture to avoid crashes) |
| 9. Basic Comprehensive Practical Project | ① Project: Simple Address Book (implement addition/deletion/modification/query + file saving); ② Code Review: Sort out core knowledge points + common errors; ③ Assignment: Optimize the address book (add search function) |
https://github.com/XianZS/PythonLearning/tree/main/python_basic_learning
https://github.com/XianZS/PythonLearning/tree/main/python_basic_learning/word
| Module Order | Core Content |
|---|---|
| 1. Advanced Functions | ① Variable-Length Arguments (*args/**kwargs, case: batch processing an uncertain number of parameters); ② Decorators (basic principles + syntactic sugar, cases: function timing, log recording); ③ Generators (yield keyword, case: batch generating data to solve memory usage issues); ④ Iterators (iter/next, compare differences with generators); ⑤ Pitfalls to avoid: order of nested decorators, lazy evaluation of generators; ⑥ Practical Exercise: Optimize the previous address book project with decorators (add logs) |
| 2. Object-Oriented Programming (OOP) | ① Classes and Objects (definition/instantiation, cases: creating "Student class" and "Teacher class"); ② Encapsulation/Inheritance/Polymorphism (core features, case: Student class inherits from "Human class" and overrides methods); ③ Class Attributes and Instance Attributes (pitfall to avoid: attribute name conflicts); ④ Magic Methods (init/str/repr, etc., case: optimize the print output of classes); ⑤ Practical Exercise: Reconstruct the address book project with OOP (create Contact class to implement encapsulation) |
| 3. Modularization and Package Management | ① Module Import (import/from...import, pitfalls to avoid: circular import, module path issues); ② Custom Modules (split the address book project into multiple modules: business logic/file operations/exception handling); ③ Package Creation (role of init.py); ④ Virtual Environment (venv creation to solve dependency conflicts); ⑤ PyPI Release (simple demonstration, optional); ⑥ Practical Exercise: Split the address book into a modular project and create a virtual environment |
| 4. Basic Data Processing (Connecting Standard Libraries/Third-Party Libraries) | ① Advanced String Processing (basic regular expressions, re module, case: extracting phone numbers/emails from text); ② Date and Time Processing (datetime module, cases: log time formatting, calculating date differences); ③ Data Serialization (json module, case: convert address book data to JSON for saving); ④ Practical Exercise: Batch extract contact information from text and save as JSON |
| 5. Basic Network Programming | ① Basic HTTP Protocol (request/response, GET/POST methods); ② urllib Library Usage (case: simple web page text crawling); ③ requests Library (third-party, simplified requests, case: crawling weather data); ④ Pitfall to avoid: basic anti-crawling (User-Agent setting); ⑤ Practical Exercise: Crawl the weather of the local city and save it as text |
| 6. Database Programming | ① Basic SQLite (built-in database, no installation required, case: creating a student score database); ② Basic SQL Statements (addition/deletion/modification/query, CRUD); ③ Python Operation SQLite (sqlite3 module, case: storing address book data in the database); ④ MySQL Introduction (optional, pymysql library, case: batch inserting data); ⑤ Pitfalls to avoid: SQL injection, database connection closure; ⑥ Practical Exercise: Replace files with databases to optimize the address book project |
| 7. Introduction to Concurrent Programming | ① Threads and Processes (conceptual differences, GIL Global Interpreter Lock); ② threading Module (thread creation, case: multi-threaded image downloading); ③ multiprocessing Module (process creation, case: multi-process data processing); ④ Pitfalls to avoid: thread safety issues, impact of GIL on CPU-intensive tasks; ⑤ Practical Exercise: Multi-threaded crawling of weather data from multiple web pages |
| 8. Advanced Comprehensive Practical Projects (2 Projects, Covering Multiple Modules) | ① Project 1: Simple Web Crawler + Data Visualization (crawl commodity prices from a platform, plot with matplotlib, covering network requests, data processing, visualization); ② Project 2: Student Score Management System (upgraded version, covering OOP, database, modularization, exception handling); ③ Each project is divided into 3 videos: "Requirements Analysis → Code Implementation → Optimization Review" |
| 9. Advanced Stage Review and Direction Guidance | ① Core Knowledge Point Sorting (mind map format); ② Summary of Common Errors and Solutions; ③ Follow-up Direction Guidance (data analysis/web crawling/automation/backend development) |
https://github.com/XianZS/PythonLearning/tree/main/python_advance_learning
https://github.com/XianZS/PythonLearning/tree/main/python_advance_learning/word
| Usage Scenario | Standard Library Modules | Main Usage Description |
|---|---|---|
| File and Directory Operations | os, os.path, shutil, pathlib, tempfile |
Provide operating system interfaces for file/directory creation, deletion, copying, moving, path processing, and temporary file management. |
| Data Processing and Formats | json, xml, csv, configparser, pickle, sqlite3, collections, itertools |
Process JSON/XML/CSV data, parse configuration files, serialize objects, operate SQLite databases, and provide efficient container/iterator tools. |
| System Interaction and Processes | sys, subprocess, argparse, logging, platform |
Access command-line arguments, start subprocesses, record logs, obtain system information, and interact with the Python interpreter. |
| Text Processing | re, string, difflib, textwrap |
Regular expression matching, string operations, text difference comparison, automatic line wrapping/filling and other text processing functions. |
| Date and Time | datetime, time, calendar |
Process dates, times, and calendars, supporting time calculation, formatted output, and time zone conversion. |
| Mathematics and Scientific Computing | math, cmath, random, statistics, fractions, decimal |
Provide mathematical functions, complex number operations, random number generation, statistical calculations, and high-precision fraction/decimal operations. |
| Concurrency and Asynchrony | threading, multiprocessing, concurrent.futures, asyncio, queue |
Implement multi-threading, multi-processing, thread pools/process pools, and asynchronous IO programming, supporting task queues and concurrency control. |
| Debugging and Testing | pdb, unittest, doctest, traceback |
Code debugging, unit testing, document testing, and exception stack information acquisition, facilitating development and testing processes. |
| Network Communication | socket, urllib, http, ftplib, smtplib |
Implement low-level network communication, HTTP requests, FTP file transfer, email sending and other network protocol functions. |
| Encryption and Security | hashlib, hmac, secrets |
Provide hash algorithms, message authentication codes, secure random number generation, and SSL/TLS encrypted communication support. |
https://github.com/XianZS/PythonLearning/tree/main/python_stdlib_learning
https://github.com/XianZS/PythonLearning/tree/main/python_stdlib_learning/word