10  command-line

Command line is where we execute our python programs. You can see an example of command line in linux below:

Command Line Linux

We can open command line in windows two ways.

10.1 opening command line using run menu

  1. Using run menu, use Windows+R and write cmd

run cmd

cmd example window
  1. After we open command line (windows) / Terminal (MacOS), we go to directory of our source files and run following command. Here cd means change directory. We are starting in our home directory, from there going to Desktop and python-codes directory. Write python hello.py to run example hello world program. Do not forget to change hello.py to name of your program like “program_name.py”

    cd Desktop cd python-codes python hello.py

run cmd

10.2 In Explorer writing cmd

Go to the folder where your python files are. Below in “C:\Users\ati_o\Desktop\python-codes”

open folder in explorer

write cmd in address bar like below:

write cmd in address bar

A new cmd window will be opened in this folder. Write python hello.py to run example hello world program. Do not forget to change hello.py to name of your program like “program_name.py”

write cmd in address bar
python hello.py

10.3 Video Tutorials

See below videos for more information.