2. Write Python Script to Notepad and execute from Command Prompt

Publié le: 14 août 2017
sur la chaîne: Manish Kumar
9,439
69

In previous video we have seen how to install python in the System.

We have also seen how to write Hello World program using IDLE.
IDLE - Integrated DeveLopment Environment.

In this video we will see "How to run Python script from command prompt".

1. Install Python. [Visit my previous tutorial]

2. Environment Setup.

Why we need to set Environment ?
-------------------------------
"python" is the name of interpreter for Python programming language.
python.exe interpreter is present inside Python installation directory usually in Program Files.
Hence we need to tell OS about python interpreter.
Set Python installation directory to the PATH variable.

SET UP PATH
-----------
Go to the directory where python.exe file is present.
Usually inside "C:\Program Files\Python 3.5"

Copy this location from address bar.
Now go to the System properties. [Shortcut for windows 8 : Alt + C + S ]
Click on Advanced System Settings.
Click on Environment Variables.
Under user variable click on New...
Give variable name as PATH (or path)
[
If you have previously created PATH variable then click on Edit
Add a Semicolon to the existing value.
Then paste the copied location.Then OK, OK, OK.
]

Paste the copied location inside Variable Value.
Click on OK ,OK OK


3. Write Python code to notepad.
Now check whether python is install properly and path is set or not .
Open Command -
Hence path is set properly.


Create a folder on Desktop with any name. ["Python Programs" in my case]
In the address bar type "cmd" and hit Enter.
Type "notepad First.py" [without double quotes] in the Command prompt.
In the notepad write your Python code -
print("Hello World")
Save this file. (Ctrl + S)
Now go to the command prompt.


4. Run the python script from command prompt.
Type python First.py (python name_of_file.py)
Python programs have .py extension.
You will see Hello World in the Python command prompt.

Thanks for watching ...


Sur cette page du site, vous pouvez voir la vidéo en ligne 2. Write Python Script to Notepad and execute from Command Prompt durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Manish Kumar 14 août 2017, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 9,439 fois et il a aimé 69 téléspectateurs. Bon visionnage!