Summary-run code from the command line
Command Line Summary
In the above command-line tutorial, you learned how to execute the following command: LS: List directory content CD: Go to other directory pwd: Display the current directory (that is, the working directory) Open/start: Open a file (on Mac and Windows computer) Touch: Create a specific New file for extension or file type mkdir: Create a new directory RM: Permanently delete a file rmdir: Permanently delete an empty directory Rm-r: Permanently delete a directory and its contents (no confirmation process, please use caution.) Rm-ri: Permanently deletes a directory and its contents (with a confirmation process) run the Python file from the command line
Now you can use the commands you learned in this tutorial to run Python code on your computer. Follow these instructions: Use the '. Py ' extension to save the Python code. Please note the location of this file on your computer. Open a shell window. Use the command line to navigate to the directory where the Python file is saved. Run the python file by typing the full name of Python followed by the Python file. For example, to run a file called test.py, which is located in your working directory, you will execute the Python test.py command. (Note: For Windows users running Git Bash, you should execute a command winpty python test.py to run your Python file.) In the shell window, you will receive the output of the Python code. (Note: Remember that when you execute the python file from the command line, you need to save any changes you made to the Python file-for example, changes made through a text editor.) )