程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python (III) -- how to run Python programs

編輯:Python

List of articles

  • Python( 3、 ... and )—— How to run Python Program
    • 1、 Terminal operation
    • 2、 Source file run
    • 3、Pycharm2022.1 download
    • 4、Pycharm Simple configuration
    • 5、Python notes

Python( 3、 ... and )—— How to run Python Program

1、 Terminal operation

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 .

2、 Source file run

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 >

3、Pycharm2022.1 download

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 :

4、Pycharm Simple configuration

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 :

5、Python notes

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 """

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved