1, Python first knowledge

Source: Internet
Author: User
Tags sublime text

Install Python under 1-1.window

1. The selection of the installation source program:

https://www.python.org/Choose python2.7x or 3.5X, the latter is not backward compatible; Choose the appropriate version of your computer to download, 64-bit or 32-bit; 2. Configure Environment variables:Click "My Computer"--right--"properties"--"Advanced system Settings"-"Environment variables"-Select "path" in the system variable, then click "Edit" to add the Python installation path after the variable value, such as "C:\Python27" Note that different environment variables are separated from environment variables by ";", but the end cannot have semicolons. test python under the 3.cmd command:Bring up the Command Prompt window under window and enter "Python" to see if the interface appears as shown, and if so, the installation succeeds: attached: The method for window to cut out the tool:Press Win+q shortcut key to bring up the Find bar, enter the word "", see the work after the "lock to the taskbar" 1-2. How to write a python program 1. Edit python on the cmd command line:Enter "Python" in the cmd command, bring up the Python development environment, and then enter the Python statement as shown in: 2.Python Editor Selection:The first option is to directly call the Python's own idle, and the second option is to download a third-party Python editor, such as pycharm,sublime text;  3. How do I enter multiple lines of code in Python's own idle? Open the python's own idle, then click the shortcut key "CTRL + N", bring up the Code editor as shown: Enter multiple lines of Python code, as shown, and then save: click on the"Run"--"Run Module"You can see the effect in Python idle, or just clickshortcut key F5To run. 4. How to exit Python development mode:Enter "Python" in the CMD environment to enter Python development mode, first press and holdCtrl key,Then press^+z, and then tapEnter keyYou can exit the Python development mode as shown in: 1-3. Run a python program Method 1:Open the python's own idle, then click the shortcut key " CTRL + N", bring up the Code editor as shown: Enter multiple lines of Python code, as shown, and then save: click on the"Run"--"Run Module"You can see the effect in Python idle, or just clickshortcut key F5To run. Method 2:Enter the Python program in the notebook that comes with the window and save it as. py formatfile, and then call run the source file in cmd (Note When you run the. py source file in cmd, do not open the Python development mode),when you run a Python source file in cmd, you must first enter the file disk where the file resides., if I have just edited the text1.py source file in the D-disk, then first of all toin cmd, enter "D:"D drive into the computer, and then enterpython+ space +the full name of the Python source file to run test1.py(including extension. py), press the ENTER key to run. (if it's a folder on the D drive, you'll need to use it before you enter D.)CD command to enter a specific folderSuch asCD python represents the Python folder) attached:If the computer hides the file name extension, you can first put the file in a folder, then click "View" in the Folder Options bar, tick "file extension"

1, Python first knowledge

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.