Getting started with python

Download python3, run python code in a terminal window and a simple text editor. The simplest code such as: printt("Hello python world")

1. Run in the python terminal window


In a command window, the cd command can navigate the file system, and the dir command can list all files in the current directory. Since I downloaded python to the E drive, hold down the shift key on the E drive and right-click the mouse to select "Open command window here". (Enter python in the terminal window and press Enter. If the python prompt >>> appears, it means that python is installed on your system.)


Second, the text editor to run the python program

First of all, build a python programming environment in different operating systems, mainly in LINUX, OS C, Windows system to build a python programming environment, I use Windows system, and then I may use LINUX system (mainly a matter of time, did not find redhat linux 9.0 .iso file). When running python in a terminal session, a command window is opened and a python terminal session is started. Similar to one, to close the terminal session, press Ctrl+Z, then press Enter or execute the command exit().


Install a text editor, Geany is recommended, you can visit http:\\geany.org\, click Releases under Download, find and install a file similar to geany-1.33_setup.exe. Next, create a folder for storing the project and name it python_work, create a new file hello_world.py in Geany and save it to python_work. Enter the following line of code in it: print("Hello python world!"), then press the icon of the two gears to run the program:



Most programs can be run from the editor, but when the problem to be solved is more complex, the program written may need to be run from the terminal.




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324650240&siteId=291194637