Python Basic Primer Learning Notes (Python environment setup)

Source: Internet
Author: User
Python learns the first article. Summarize the basic knowledge of python that you have learned before.

I. Knowledge of Python

First we have to understand this: the name Python is drawn from Monty Python, not from the meaning of the python known to all. Why do we have to learn python? As far as I am concerned, I know that watercress is using, attaching importance to Python, plus I want to learn web crawler technology, so I want to learn Python programming. In addition, in foreign countries, Yahoo and Google are using Python. Well, Python is worth our hard work.

Second, hello,world!

First we need to install Python, you can directly access Http://www.python.org/download, download the latest version of Python. You can then install it directly according to the steps of the Installation Wizard, which is simple.

After the installation is complete, go to cmd (Windows), enter Python, press ENTER, the DOS window enters the interactive Python interpreter, then we can see the long-awaited HelloWorld.

Not at ease, or for everyone to briefly introduce the python environment to build.

There are a lot of compilers about Python, here are only two, for reference only:
1), to the official website download Python2.7 compiler idle (easy to install, easy to use): https://www.python.org/
After the installation is complete, you can see in the Start menu:

Click Idle to open the editor to write the applet.

2), another Python compiler pycharm (interface layout and VC6.0 very similar, slow startup) to the site download: http://www.jetbrains.com/pycharm/download/Choose the right machine to download;

Third, the basic knowledge

Let's first look at the numbers, expressions, and statements in Python, and simple user input, where we can relate to C + + BASIC programming in a similar way, and I'll show you the simple use of Python directly.

You need to be aware of the differences between Python and C + +, where Python provides an operator for dividing the integer--double slash

3.1 Note: the pound sign (#) is identified as a comment in Python.

3.2 string: when printing a string statement with print, either single or double quotation marks are possible, but if there is a single quotation mark between the strings, we use two kinds of output methods: The double quotation mark output or the quotation mark of the string to escape. Accordingly, if there are double quotes between the strings, we can use single quotation marks or the quotation marks of the string to escape. The escape method is to precede the quotation mark in the string with a backslash.

When we output a string, we can use ' + ' to stitch two output strings, although not many, but very useful.

In addition, the REPR function creates a string that represents the value in the form of a valid expression, and the function of repr (x) can also be implemented with ' X ' (note is the anti-quote).

If we need to enter a very long string, we need to do a newline at the input, and then enter, we need to use three quotation marks instead of ordinary single quotes.

the difference between the 3.3 input and the Raw_input function: both are functions that implement user input, but if we enter a string with quotation marks, then input does not reflect the original content, and the raw_input will save the quotation marks.

Python is an interpreted, object-oriented, high-level programming language that is easy to understand relative to C + + and Java. In Javaweb study, work hard to learn python, and then have the opportunity to learn the crawler on the tall.

I hope you will enjoy this article.

  • 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.