Skip to playerSkip to main contentSkip to footer
  • 1 year ago
Run Python Script

Transcript
00:00In this lesson, you learned how to run Python scripts.
00:08In the earlier lesson, we have learned that executing a single Python command or statement
00:16using a Python interactive interpreter.
00:20However, in this lesson, you will learn how to execute multiple Python statements using
00:30a Python script file.
00:32A Python script file can contain multiple Python commands or code statements, usually
00:38created using a text editor like Notepad or Notepad++ or using an IDE tool like Eclipse
00:47or IntelliJ.
00:50In this lesson, we will use Notepad++.
00:54So open the text editor and enter some sample Python code statements, let's say, hello user.
01:17We'll just add this three times, save the file, just save it in the desktop location
01:32and the script file extension should be .py, python script.py, save and close within double
01:53quotes.
01:54Click on save to save the script file.
01:59This is how the text editor highlighted the commands, Python command print, okay.
02:08Once you are done with the script file, open the command line form, go to the script location,
02:23so cd stop, okay.
02:31So this is the Python script file that we have created.
02:38So to run the Python script, enter the command Python and specify the script file.
02:47Notice that the script file has run and you can see all the three statements got executed.
03:00In the next lesson, we'll learn how to execute the Python script using an IDE tool like Eclipse.
03:07Okay, thank you.

Recommended