Python's first knowledge of learning Python

Source: Internet
Author: User

Python

As an object-oriented, interpreted programming language. With simplicity (by narrowing in to distinguish between different block of statements), enrich the powerful library.

Multiple modules can be imported using the feature is also called dehydration language.


Django is a Web development framework for Python


Statement BLOCK:

Python uses the same indentation to determine which code is the same block of statements. Special attention should be paid to the development of the program


Variable:

Python variables do not need to be declared in advance. What type of value you assign to the variable name, and what kind of variable it is. In Python, a variable is simply a label that points to a block of memory in one area. For variable values, there is a reference count inside, and when a variable value reference in a block of memory is 0 o'clock, the memory block is reclaimed by the garbage collection mechanism.


String:

Python is a case-sensitive language (' a ' is not the same as ' a ')

Create string types in Python by using single quotation marks ', or double quotation marks, to include strings. There is no character data type in Python, and a string type of length 1 can also be interpreted as a character type.

In Python, if you enter a string that includes single or double quotation marks, you can use a different quotation mark that differs from the one that appears to include the string. (For example, if you want to enter single quotes, use double quotes to include all the strings, or vice versa).

The second method is escaped with ' \ ' (backslash).

The third is the method of using the source string. Add R to the front of the string

Python uses three consecutive single or double quotation marks to represent a multiline string.

Example: "I am six old,

How old is You

‘‘‘


BIF (built-in function of Python) Built in function

To see what built-in functions are in Python, you can use command Dir (__builtins__) to view

To see the usage of a function, you can use the command Help (function)

Input function:

Used to accept the user's input value, which returns a string data type

int function

Converts a data that can be converted to shaping data to an integer type. Error (value error) if converting to a number that is not in numeric format


Print function:

Used to print the relevant content, in the Python2 version, print does not have to be followed by parentheses, while in the Python3 version the parentheses are required. Or you'll get an error.


Imporr function:

Modules used to import third-party

Import random as AA

Used to import a function in a third-party module

From random import randint as Randint

You need to add the module name when using the function (in case of importing a third-party module)


IDLE:

The interface that the program interacts with the user in Python, the user enters the command, and the program returns the result to the user. A CMD window equivalent to the Linux shell,windows. Run a well-written Python program with F5.




This article is from "Angry Little Fai" blog, please be sure to keep this source http://cycle.blog.51cto.com/8569872/1672818

Python's first knowledge of learning Python

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.