Enter the code directly in the command line window , Press enter to run the code , And see the output immediately ; Execute a line of code , You can also continue to enter the next line of code , Enter again and see the results …… The whole process is like we're talking to a computer , So it is also called interactive programming .
Python The source file is a plain text file , There is no special format inside , You can open it with any text editor .
Python The suffix of the source file is .py,Python 3.x The default source file encoding format is UTF-8.
1、 Create the source file , newly build txt text file , Change the suffix to .py(), Save the content after writing :
print(' Run as source file python Program ')
a = 100
b = 4
print(a*b)
2、 Execute source file
Command format : Source file paths can be relative or absolute
python < Source file path >
PyCharm yes JetBrains Company R & D , Used to develop Python Of IDE(IDE:Integrated Development Environment Integrated development environment ) development tool .
PyCharm function : debugging 、 Syntax highlighting 、Project management 、 Code jump 、 Smart tips 、 Done automatically 、 unit testing 、 version control .
PyCharm Yes 2 A version , Namely Professional( pro ) and Community( Community Edition ). among , The professional edition is for a fee , Free trial 30 God ; And the community version is completely free .
download Pycharm 2022.1 Installation package
Official website download address :https://www.jetbrains.com/pycharm/download/other.html
Select the version and system and click download :
install
Check create desktop shortcut , Easy to open :
After installation , Check Run Pycharm, Click on Finish Running software :
Create document notes
Settings—>Editor—>File and Code Templates—>Python Script
Write an annotation template on the right :
# _*_ coding: utf-8 _*_
# @Date: ${YEAR}-${MONTH}-${DAY}
# @Author: Tang Jing Fang
# @File: ${NAME}
# @Project: ${PROJECT_NAME}
See the effect :
Single-line comments
Python Use the well number #
As a symbol for a single line comment ( Shortcut key :ctrl+?):
# Single-line comments
Multiline comment
Python Use three consecutive single quotes ’'' Or three consecutive double quotes """ Annotate multiple lines of content :
''' many That's ok notes Interpretation of the '''
""" many That's ok notes Interpretation of the """