Python Basics Summary

Source: Internet
Author: User

If there are other programming language basics, Python is a very good language to get started with. Application, the "need to pick up" to describe the most appropriate.

First, put on some recommendations.

Install on:

1, python3.5.1 (recommended website direct download, comes with idle), installation is not troublesome, remember to increase the environment variables can be

2, Editor: Sublime In fact, and did not use a lot, but the recommended person super many, cracked version of the internet a lot, according to resources download can

3, IDE: Strong push Pycharm to JetBrains software persistent love convenient and beautiful online can find the registration code, students with EDU mailbox can be used free of charge, of course, support genuine!

Familiar on:

Language learning Uphold the word: no matter how simple the code, insist on yourself knocking over ~

http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000

This is Liu Xuefeng's tutorial Web site, the study of Python, the author of this tutorial with the O'Reilly series of introduction Python study together, basic all the code have to knock over it. Here are some of the key points to do some sorting. Although, many finely-grained knowledge points are still not very clear.

First of all, after the initial study, post Python personally experience a few deep features:

1. Simple

Python is a simple language with minimal text. Reading a good Python program feels like reading English, despite being very strict English. This pseudo-code feature of Python is one of its greatest strengths, allowing you to focus on solving the problem rather than the language itself.

2. Easy to learn

As you will see, Python is very easy to get started with. As you just mentioned, Python has an exceptionally simple syntax.

3. Free Open Source

Python is an example of a floss (free/free and open source software). Under some simple terms, you are free to distribute copies of the software, read its source code, modify it, or use it as part of a new free program. Floss is based on the concept of shared knowledge communities, which is one of the reasons Python is so good-it is created and constantly improved by communities that want to see better python.

4. Advanced language

When you use Python to write programs, you never have to worry about low-level details, such as how your program manages memory usage, and so on.

5. Object-oriented

Python supports both process-oriented and object-oriented programming. In a process-oriented language, a program is built around a process or function (just a reusable program fragment). In object-oriented languages, programs are built around objects (a combination of data and functionality). Python has a very powerful but overly concise way of doing object-oriented programming, especially in large languages such as C + + or java.

Next, talk about your experience. The first four points are obvious. However, in the object-oriented understanding of the problem, Python seems to be stronger than Java. Anyway, for the individual, Java object-oriented understanding for a long time, the application here is relatively smooth. For the inheritance, polymorphism and other problems, there are good applications.

In addition, it has a lot of strong features, but the author is not applied to large-scale projects at this stage, so there is no profound experience of portability. On the extension library, the next article will explain.

Here's a clue to the basics of Python that you can use as a learning outline:

1. Data type: Booleans (True & False) Integer float string

2, Data structure: List of tuple dictionary sets is a basic and common attention to each data structure of the respective methods, such as append delete Introducing Python This writing is very specific, can be used as a reference book

Take a look at the following example: Distinguish

Of course, the data structure is not independent, can be mixed using nested, specific examples, self-learning

3, code structure for if while usage note specification, and other language area separate (the author most of the mistake is missing a lot of colons, hope to write accustomed to C + + of the Pot Friends attention ~)

4. Functions

Function can be said to be the soul of programming. The first thing you need to know about the function specification is that there are several issues involved:

(1) Parameter problem, the python function parameter is divided into: Required parameter default parameter variable parameter keyword parameter and named keyword parameter, the problem of these five kinds of parameters clear, for programming extremely beneficial

(2) Gather positional Arguments with * Gather Keyword Arguments with * *

(3) Function nesting what problem does not say more, everybody in practice slowly comprehend

(4) Emphasize: lambda function, anonymous function, the use of the frequency is quite high (put the usage: can be very good savings definition)

(5) Two special types of containers are presented here: generators and decorators

Recommend two articles, analysis is very good

Generators:http://www.jb51.net/article/63929.htm

decorator:http://blog.csdn.net/wklken/article/details/8118942

5. Module

For modules can be imported whole, can also be introduced only parts, modular debugging will be more efficient

6. Class (Object-oriented)

First key point: Inherit a (object) or a (B)

The second key: calling a method

The third key point: the "Super" use Super () if the child was doing something its own and still needs something from the parent (as in Real life).

Common __name__ represent non-modifiable variables

Common usage

(1) Property properties are generally for private variables, or for some specification checks

Two major functions

    • To convert a class method to a read-only property
    • Re-implement a property setter and getter method

Two different ways

    • Property (Get_name, Set_name)
    • @property
      ... def name (self):
      ... print (' inside the getter ')
      ... return Self.hidden_name
      ... @name. Setter
      ... def name (self, input_name):
      ... print (' inside the setter ')
      ... self.hidden_name = Input_name

(2) Special methods

Example:

Other details are not mentioned. I hope you have a good look at the books and tutorials, you might as well see a few times, every time there will be different experience

Python Basics Summary

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.