Summary-run code from the command line

Source: Internet
Author: User
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.) )

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.