Basic introduction to Python basics in Python development environment

Source: Internet
Author: User

Hello python first knowledge of Python language

Python (English pronunciation:/' pain/), is an object-oriented, literal translation computer programming language, invented by Guido van Rossum at the end of 1989, the first public release was released in 1991. The Py-thon syntax is simple and clear, with a rich and powerful class library. It is often nicknamed the Glue language, which makes it easy to easily connect a variety of modules (especially C + +) made in other languages. The Python language inventor Guido Van Rossum invented the Python language in the early 90, Python is one of the few high-performance, general-purpose computer programming languages currently running on modern computers, and the Python language supports a variety of free-to-use toolkits. Can be run under the current mainstream operating system and platform, you can download a variety of Python-related technical documents and software from the http://www.python.org website. 8

Run Python statements in Python-shell

Python is an interactive, interpretive language, and simple Python statements can be run directly in Python's own Sh-ell . The Python-shell tool is ideal for beginners when it comes to learning grammar.

The Windows operating system can be found in the Start menu and click on the idle (Python GUI) under Python2.x.y, while Linux users simply type python in the terminal to enter Python's interactive Shell Environment.

Exit Python-shell You can type quit () or ctlr+d to exit Python-shell.

In Python-shell, you can experiment with the basic syntax of Python by typing the following statements in turn.

>>>x = 12>>>y = 13>>>z = x + y>>>print z25>>>print ' Hello The cruel world! ' Hello The cruel world!

Note 1: ">>>" is a command under Python-shell , and a line without ">>>" represents the output of the execution result of the previous statement.

NOTE 2: the letter x, Y, z in front of the equal sign ' = ', we call it in Python, the value of the expression to the right of the equal sign is assigned to the variable on the left.

Now let's take this to understand the above code, the code line 1th is to create a variable x and assign a value of 12, the 2nd line to see the value of the x variable, the 3rd line is the value of the output x, the 4th line is to create the variable y and is assigned a value of 13, 5th line to see the value of the Y variable, The 7th line is to do an arithmetic operation, the values of x and y two variables are summed and the result is assigned to the variable z, the 8th line of the code is the value of the print variable z, that is, the X plus y and print output, the code 9th line is the output, the code 10th line is the print string ' Hello the cruel world! ', line 11th results output in line seventh.

We can type x directly into the Python-shell , y enter, and z enter directly to see the values of the X, Y, and z variables that have just been assigned.

>>>x12>>>y13>>>z25
Writing Python programs in Idle-editor

After installing Python2.7.5 under the Windows platform, you can find the Python2.7 folder from the Start menu and click on the IDLE (Python GUI) button to launch it into the Python-shell, on the menu bar of the idle (Python GUI), select "File" → "New Windows" to enter the idle python-editor Program code text editor. In the idle python-editor Editor You can write a multi-line statement program as shown below.

After the source program has been written, you can run and test the program. Before testing the program to save the source code, you can use the menu bar "File" → "save" to save the written Python program as x.py, and then in the idle Editor Press the F5 key or select Editor Menu "Run" → "run Module" or simply press F5 to run the x.py program you just wrote.

x = 12y = 13z = x + yprint Z

The results of the program x.py Run as follows:

25
Run Python statements in Ipython

IPython is a python interactive shell that works much better than the default Python shell, supports variable auto-completion, auto-indent, supports bash shell commands, and has many useful functions and functions built into it. Start with the Ipython command.

Install Ipython under Ubuntu

Under Ubuntu, just type the command in the terminal sudo apt-get install Ipython to install.

Install Ipython under Windows

Run → cmd → easy_install ipython to install Ipython software.


This article is from the "Python Training Zhipu Education" blog, so be sure to keep this source http://jeapedu.blog.51cto.com/7878264/1616999

Basic introduction to Python basics in Python development environment

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.