Python Learning (1), Python Learning (

Source: Internet
Author: User

Python Learning (1), Python Learning (

Installation and Use

1. Take 2.7.6 as an Example

Installation path: D: \ Program Files (x86) \ Python27 \
After the installation is complete, open the software. If the prompt is: 'python' is not an internal or external command, or a program or batch file that can be run.

You need to manually add environment variables.

2. Two running Modes

Command Line Mode
(1) use notepad ++ to write hello. py, for example, print 'Hello world'
(2) Open the command line window in the saved path



Distinguish PythonInteraction Mode:

C: \> is the command line mode provided by Windows, and >>> is in the Python interactive environment.
In command line mode, you can run python to enter the Python interactive environment, or you can run python hello. py to run a. py file. However, in the Python interactive environment, you can only enter Python code for execution.

Summary
Use a text editor to write a Python program and save it as a file suffixed with. py. Then you can run the program directly in Python.
What is the difference between the Python interaction mode and directly running the. py file?

Directly input python to enter the interaction mode, which is equivalent to starting the Python interpreter, but wait for you to input the source code one line at a time and execute one line at each input line.
Directly running the. py file is equivalent to starting the Python interpreter and executing the source code of the. py file at one time. You have no chance to enter the source code.

Using Python to develop programs, you can write code in a text editor while opening an interactive command window. During code writing, part of the code is stuck to the command line for verification!

Related Article

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.