How to Run a Python Script on Windows

This is not necessarily an easy question. If you're already conversant in running programs from the Windows instruction then everything will seem obvious; otherwise, you would possibly need a touch more guidance.

Unless you employ some kind of integrated development environment, you'll find yourself typing Windows commands into what's variously mentioned as a "DOS window" or "Command prompt window". Usually, you'll create such a window from your search bar by checking out cmd. you ought to be ready to recognize once you have started such a window because you'll see a Windows "command prompt", which usually seems like this:

Many people use the interactive mode as a convenient yet highly programmable calculator. once you want to finish your interactive Python session, call the exit() function or hold the Ctrl key down while you enter a Z, then hit the "Enter" key to urge back to your Windows prompt.

You may also find that you simply have a Start-menu entry like Start ‣ Programs ‣ Python 3.x ‣ Python (command line) that leads to you seeing the >>> prompt during a new window. If so, the window will disappear after you call the exit() function or enter the Ctrl-Z character; Windows is running one "python" command within the window, and closes it once you terminate the interpreter.

Now that we all know the py command is recognized, you'll give your Python script thereto. You'll need to give either an absolute or a relative path to the Python script.

Get more knowledge about How to Run a Python Script on Windows.


This free site is ad-supported. Learn more