[Python study notes] 2. Getting started with Python learning

This series is for yourself to learn Python notes. If there are errors, please correct me.

Getting started with Python development

Python download installation and configuration

  1. Enter the official website www.python.org/downloads/

  2. According to the installation platform (Windows, Linux, MAC OS) select the appropriate version to download

  3. Installation (no difference from general software installation)

  4. Environmental variable issues

    Check: "Add Python to environment variable". This will add Python to the environment variable Path, and we can run the Python interpreter in the command line mode of windows

    Problem: Installation error due to missing dll

    Download the dll repair file, run the repair, and then restart the computer.

  5. After the installation is complete, if it is windows, open the command line and enter python to verify whether the installation is successful

Python development environment

Development environment, English is IDE (Integrated Development Environment)

Don’t worry about which development environment to use. The development environment is essentially a encapsulation of the Python interpreter python.exe. The core is the same. It can be said that “The development environment IDE is just a plug-in of the interpreter, just to make programming more convenient for programmers. To reduce the error rate, especially spelling errors

Common development environments are:

  • IDLE
  • Pycharm
  • wingIDE
  • Eclipse
  • IPython

Interaction model

  1. Enter the command line window, enter: python
  2. '>>>' is the "prompt"
  3. The interactive window is closed:
    • Ctrl+Z and carriage return
    • Enter the quit() command
    • Close the command line window directly
  4. Interrupt program execution: ctrl+C

The interactive mode works in the same way as Python processes files. Except for one point: when you enter some values, the interactive mode will automatically print the output, and the print statement must be used in the Py file

Use of Python development environment

No sorting is done here, everyone can choose their favorite development tool to use.

Basic format of the program

  1. Proper space, indentation issues

    • The whitespace at the beginning of a logical line (spaces and tabs) is used to feel the indentation level of the logical line, which is used to determine the grouping of statements
    • The statement starts in the first column of the new row
    • Uniform indentation style
      • Use a single tab or four spaces for each indentation level (IDE will automatically set the tabs to 4 spaces)
      • Python uses indentation instead of {} to represent program blocks
  2. Python is case sensitive

  3. Comment

    • Line comment

      Add # before each line of comment, when the interpreter sees #, then ignore the content after this line #

    • Paragraph comment

      Use three consecutive single quotation marks ('''). When the explanation sees''', it will scan to the next ``', and then ignore the content between them.

Search [Zixin] on WeChat or scan the QR code below to make friends and make progress together. The article is continuously updated. At present, I am organizing the study notes of Python hundred battles, and I look forward to more updates in the future.
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_51656605/article/details/111711538