From Beginner to Pro in Python

Follow 👆 the public account and reply "python" to get a zero-based tutorial! Source from the internet, please delete if infringed.
Tutorial Get the tutorial method at the end of the article!!

Tutorial Get the tutorial method at the end of the article!!

Table of Contents

  • 1. Download and Install PyCharm

  • 2. Download and Install Python

  • 3. Configure Python in PyCharm

  • 4. Configure Mirror Sources for Faster Downloads

    • 4.1) Internal Configuration of PyCharm

    • 4.2) Manually Add Mirror Sources

    • 4.3) Permanently Configure Mirror Sources

  • 5. Install Plugins (e.g., Localization?)

    • 5.1) First Code Completion Tool

    • 5.2) Second Code Completion Tool

    • 5.3) Localize PyCharm

    • 5.4) Other Plugins

  • 6. Beautiful Backgrounds

  • 7. Customize Script Header

  • 8. Ready to Start Coding!

  • 9. Introduction to Python

  • 10. Python Indentation

  • 11. Python Comments

    • 1) Single-line Comments

    • 2) Multi-line Comments

  • 12. Python Variables

    • 1) Understanding Variable Definition

    • 2) Naming Variables

    • 3) Assigning Multiple Values

    • 4) Outputting Variables

    • 5) Global and Local Variables, Global Keyword

    • 6) Exercises

  • 13. Python Data Types

    • 1) Setting Data Types

    • 2) Getting Data Types

    • 3) Setting Specific Data Types

    • 4) Exercises

  • 14. Python Numbers

    • 1) Integers

    • 2) Floating-point Numbers

    • 3) Complex Numbers

    • 4) Type Conversion

    • 5) Random Numbers

    • 6) Exercises

  • 15. Python Specified Variable Types

  • 16. Python Strings

    • 1) Format Single Parameter

    • 2) Format Multiple Parameters

    • 3) Convert Lowercase to Uppercase

    • 4) Convert Uppercase to Lowercase

    • 5) Remove Spaces

    • 6) Replace Strings

    • 7) Split Strings

    • 8) Slicing

    • 9) Understanding Strings

    • 10) Traversing Strings

    • 11) String Length

    • 12) Checking Strings

  • 17. Python Boolean Values

    • 1) Comparison

    • 2) Evaluating Values and Variables

    • 3) Boolean Truth Values

    • 4) Boolean False Values

    • 5) Functions Returning Boolean Values

  • 18. Python Operators

    • 1) Arithmetic Operators

    • 2) Assignment Operators

  • 19. Python Lists

    • 1) Case-sensitive Sorting

    • 2) Case-insensitive Sorting

    • 3) Reverse Order

    • 4) Deleting Specific Targets

    • 5) Clearing Lists

    • 6) Adding at End

    • 7) Inserting into Lists

    • 8) List Comprehensions

  • 20. Python Tuples

    • 1) Understanding Tuples

    • 2) Accessing Tuples

    • 3) Updating Tuples

  • 21. Python Sets

    • 1) Understanding Sets

    • 2) Adding Items to Sets

    • 3) Removing Items from Sets

  • 22. Python Dictionaries

    • 1) Creating and Accessing Dictionaries

    • 2) Updating Dictionaries

  • 23. If…Else Statements

    • 1) Basic Else

    • 2) Nested If Statements

  • 24. While Loop Statements

    • 1) Basic Understanding

  • 25. For Loop Statements

    • 1) Basic Traversal

  • 26. Functions

    • 1) Creating and Calling Functions

    • 2) Parameters

  • 27. Lambda Functions

  • 28. Arrays

    • 1) Accessing Array Elements

  • 29. Python Classes and Objects

    • 1) Creating Classes

    • 2) Creating Objects

  • 30. Python Inheritance

    • 1) Creating Parent Classes

  • 31. Python Dates

    • 1) Date Input and Output

  • 32. Python JSON

    • 1) Convert from JSON to Python

  • 33. Exception Handling

    • 1) Exception Handling

  • 34. User Input

  • 35. Formatted Input and Output

1. Download and Install PyCharm

PyCharm download link: http://www.jetbrains.com/pycharm/download/#section=windows Detailed steps: 1-From Beginner to Pro in Python2-From Beginner to Pro in Python3-From Beginner to Pro in Python4-From Beginner to Pro in Python5-From Beginner to Pro in Python6-From Beginner to Pro in Python7-From Beginner to Pro in Python8- Finish directly From Beginner to Pro in PythonFrom Beginner to Pro in Python

2. Download and Install Python

9-Python official website:

https://www.python.org/

  • 1

  • 2

After entering the website, click: From Beginner to Pro in Python10From Beginner to Pro in Python11- After downloading From Beginner to Pro in Python12- Add Environment Variables From Beginner to Pro in PythonFrom Beginner to Pro in PythonFrom Beginner to Pro in PythonFrom Beginner to Pro in PythonFrom Beginner to Pro in PythonRemember to double-click to install: From Beginner to Pro in Python

3. Configure Python in PyCharm

13- Double click the PyCharm on the desktop

From Beginner to Pro in PythonGive it any name (I named it Learning), then click create. If you encounter the following situation, click ok (if not encountered, just ignore it)From Beginner to Pro in Python14- Add InterpreterFrom Beginner to Pro in PythonFrom Beginner to Pro in PythonFrom Beginner to Pro in PythonFrom Beginner to Pro in PythonFrom Beginner to Pro in PythonSuccessfully as follows:From Beginner to Pro in PythonPrint successfully: indicating configuration is completeFrom Beginner to Pro in Python

4. Configure Mirror Sources for Faster Downloads

From Beginner to Pro in Python

Insert image description here

I prefer using Tsinghua’s, so I will introduce Tsinghua source here, of course, here are some good mirror sources:





    Tsinghua:
    
    https:/
    /pypi.tuna.tsinghua.edu.cn/simple
    



    Aliyun:
    
    http:/
    /mirrors.aliyun.com/pypi
    /simple/
    



    University of Science and Technology of China
    
    https:/
    /pypi.mirrors.ustc.edu.cn/simple
    

There are three types of mirror source configurations, I suggest you learn each one with me.

4.1) Internal Configuration of PyCharm

Step 1:From Beginner to Pro in PythonStep 2:From Beginner to Pro in PythonStep 3:From Beginner to Pro in PythonFrom Beginner to Pro in PythonStep 4: Copy the Tsinghua mirror source from above, paste, then okokokokFrom Beginner to Pro in PythonTest, if you encounter this problem: pip: cannot recognize “pip” as cmdlet, function, script file, or executable program name. Please check the spelling of the name, and if including the path, ensure the path is correct, then try again.From Beginner to Pro in PythonBecause I forgot to add pip to the environment variable, so add it, once like this:

From Beginner to Pro in PythonFrom Beginner to Pro in PythonFrom Beginner to Pro in PythonFrom Beginner to Pro in PythonStep 5: Exit PyCharm, because adding the environment variable requires restarting the software. We first go to cmd and enter pip, as shown here indicates successful configuration:From Beginner to Pro in PythonStep 6: After restarting the software, casually install a module, as follows: (you can see the download module speed is very fast!)From Beginner to Pro in Python

4.2) Manually Add Mirror Sources

Usage:

pip install module_name -i https://pypi.tuna.tsinghua.edu.cn/simple

For example, if I want to download the numpy module, execute the following command:

pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple

It will be done in a few seconds:From Beginner to Pro in PythonThe advantage of this method is that you don’t need to configure it like the other configurations, you just need to add:

-i https://pypi.tuna.tsinghua.edu.cn/simple

4.3) Permanently Configure Mirror Sources

This configuration is one I strongly suggest you add. Method 1: Execute the following command in cmd to create pip.ini:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

Return: From Beginner to Pro in Python

Then we just need to add this path to the system environment variable (How to add environment variables? The same operation as adding the environment variable for pip, just a different path)

Method 2:

If the command you just executed failed, you can create a folder named pip in any location on the C drive, and create a file named pip.ini under it, with the content as follows:




    [
    global]
    

    index-url = 
    https:
    //pypi.tuna.tsinghua.edu.cn/simple
    

Then add it to the environment variable.

5. Install Plugins (e.g., Localization?)

From Beginner to Pro in Python

Insert image description here

First of all, I personally do not recommend localization, finally, I will demonstrate the localization plugin. I want to recommend some good plugins. First, enter the following interface:From Beginner to Pro in Python

5.1) First Code Completion Tool

Recommended to use: TabNine, of course, Kite is also good, you can install them both, I am using both. I will demonstrate one:From Beginner to Pro in Python

From Beginner to Pro in PythonFrom Beginner to Pro in PythonFrom Beginner to Pro in PythonFrom Beginner to Pro in PythonThis pop-up page can be ignored:From Beginner to Pro in PythonTesting: Already started to have promptsFrom Beginner to Pro in Python

5.2) Second Code Completion Tool

(You can also scan the QR code at the bottom) Go to my public account: Python Tutorial Network and send: python to get the Kite software, just install and configure it without thinking. If you really can’t, add me on the left side and I will tell you.

Directly jump to this article of mine, if your effect is the same as mine, then it is successful: Kite Tool

5.3) Localize PyCharm

First of all, I personally do not recommend localization, whether your English is good or bad, you should adapt to this English interface. Of course, if you really need localization, here is the tutorial:From Beginner to Pro in Python

From Beginner to Pro in Python

Insert image description here

From Beginner to Pro in PythonFrom Beginner to Pro in Python

Now it has been fully localized:From Beginner to Pro in Python

From Beginner to Pro in Python

Insert image description here

5.4) Other Plugins

If you need to download other plugins, you can search for good PyCharm plugins on Baidu, all installed using the above methods.

6. Beautiful Backgrounds

Do you want a desktop like this?From Beginner to Pro in Python

Tutorial link: Setting up Beautiful Desktop Backgrounds

7. Customize Script Header

Do you always create a file and start with the following?From Beginner to Pro in PythonSave space, jump to this article: Customize Script Header

8. Ready to Start Coding!

Having this article means you have the most complete book, covering more than the books, and the syntax will be more detailed than the purchased books, everyone should take it slow. With this article, you will have a solid foundation and can self-learn some advanced tutorials. The author has written for several days and is really tired, hope you can support me.

Python, in short, is: easy to understand, powerful, quick to get started, and practical. If you study this article seriously, you will definitely learn the most solid Python basics. Meanwhile, I can provide free tutoring, as the author is a student and does not seek any benefits. If you need tutoring, you can join the group from the left sidebar, of course, it’s just for communication, I won’t have time to teach you all the time, I can only help you solve some problems, more depends on yourself.From Beginner to Pro in Python

9. Introduction to Python

I won’t introduce software installation, just search for Python and PyCharm installation on Bilibili, personally, I recommend using Python and PyCharm together. What is PyCharm? It is a compiler for Python. If we don’t have a compiler, it is very difficult to write code, and PyCharm provides many plugins and a beautiful interface, making your coding fast and comfortable, without headache from writing on Python’s IDE.

Note: Make sure the number of variables matches the number of values, otherwise, you will get an error.

Multiple variables with one value

From Beginner to Pro in Python

From Beginner to Pro in Python

According to the students’ learning progress, arrange corresponding Python training camps. Spending eight hours a week learning Python with me can improve yourself. The arrangement for you is free.

How to get:
  1. Like + View Again

  2. Reply “python” in the public account

Get the latest 2024 Python zero-based learning materials,Reply in the background:Python

Leave a Comment