Home  >  Article  >  Backend Development  >  What are the two programming methods in python?

What are the two programming methods in python?

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2020-01-06 09:23:139735browse

What are the two programming methods in python?

1. Interactive programming

What is interactive programming is to enter the python command on the command line. Interactive programming can be started, and the prompt window is as follows:

What are the two programming methods in python?

and also uses the print method of Python3 to print out a string.

2. Scripted Programming

Call the interpreter through script parameters to start executing the script until the script is executed. When the script execution is complete, the interpreter is no longer available.

Let’s write a simple Python script. All Python files will have a .py extension. Copy the following source code to the hello.py file.

What? Don’t know how to create a .py file??

What? Don’t know how to create a .py file? For those who are just getting started. , it is recommended to use the sublime tool (http://www.sublimetextcn.com/) to download and install it at this website (fool-proof installation, all "Next" will be ok). After the installation is complete, click on this small icon to open the editor~~

What are the two programming methods in python?

What are the two programming methods in python?

Click File--New File in the upper left corner to create a new file , enter the following code:

print('hello,Python')

What are the two programming methods in python?

and then press the shortcut key ctrl s to save. Follow the operation as shown below. You will find that the hello.py file has been saved to the D drive.

What are the two programming methods in python?

What are the two programming methods in python?

Place hello.py in the root directory of drive D and run it using the following command:

What are the two programming methods in python?

In the command line mode, run python space hello.py (a file with python execution code), press Enter, (a magical scene will appear~~) and the hello.py I just executed will be executed. hello, Python string written in py file.

python learning network, free online learning python platform, welcome to pay attention!

The above is the detailed content of What are the two programming methods in python?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn