Ways to Run Python Script or Program || By Using Windows CMD || Running Python file by using CMD

Опубликовано: 09 Октябрь 2024
на канале: Leela Soft
372
69

How to run a Python script by using Windows CMD:
By using:
python - python interpreter
py - the python launcher

How to run a Python file by using Windows CMD:
Step 1:
Choose any Text Editor:
Editplus
Sublime Text
Atom
MS Visual Studio Code

Step 2:
Write python code and save it as '.py' file extension.
Example: test.py

Step 3:
Run a Python file from CMD:
Open command prompt Win Key + R and press enter from your windows OS.
Then go to our saved python file location. Then choose one of the below commands.

python interpreter:
python file_name.py
Ex:
E:\Python_Examples>python test.py

py launcher:
py file_name.py
E:\Python_Examples>py test.py