2 ways to run Python programs

There are two ways to run Python programs:

  • Use interactive prompt interpreter
  • The traditional way of using source files

1. The first way

Open the interpreter

Write picture description here

Enter the code and press Enter to run

Write picture description here

2. The second way

Create a new python file (I created a new one under D drive)
Write picture description here

Write the following code in the file

print 'hello,world'
  • 1

Open cmd and
  enter python+space, like this "python", and then drag and drop the file to be run behind. After pressing enter, the python file is run.
Write picture description here

Guess you like

Origin blog.csdn.net/digitalkee/article/details/107941355