Python day1: first knowledge of Python

Source: Internet
Author: User

First, Python Introduction:

Python free, open source, object-oriented interpretation of the language, its syntax concise, in use without thinking about how to manage the underlying problems such as memory, and support in Linux,windows and other multi-platform operation, Python's standard library is very powerful, we just need to import it and call the methods therein, Can handle a variety of jobs, Python can also be embedded in the c\c++ program, Python is forced to indent the way the code is very readable, it is a reasonable combination of high performance and make programming simple and interesting features.

Python's main applications: Automated operations, automated testing, big data analytics, crawlers, web, and more.

The Python categories are divided into the following types:

Cpython: Compile with C, this is commonly used

Jyhton: Compiling python code into Java bytecode

IronPython: Python language implemented on net and mono

The Pypy:python implementation of Python, whose compilation execution process is the same as the C language's compilation execution (Python code-and machine code) executes faster, but is not mature enough to be used in production environments.

Second, comments and modules:

  #: Single line comment

"" "" "" (or ""): Multiline Comment

Module Type:

Built-in modules, self-written modules, other modules written by others

Import module:

(1) Import module name

(2) From Module name Import method name

(3) Built-in function __import__ ()

SYS.ARGV Capture Parameters

Third, variable

Variable names are made up of letters, underscores, numbers, and numbers can be used as a starting point, and they can also have the same names as built-in keywords.

Memory consumption of variables:

  

1 " Zhangsan " 2 " Lisi "

   

1 " Zhangsan " 2 name2 = name1

Iv. user interaction, entering characters

Raw_input (python2.7)

Input (python3.x)

Getpass: Implicitly entering content

Cases:   

1 Import Getpass 2 3 name = raw_input ("Pleaseinput username:")4 passwd = Getpass.getpass ("Please input passwd:")56  Print(name)7print(passwd)

V. Basic data types

1. Single value:

Digital

Integral type

Long integer type

Floating point Type

Plural

String:

‘‘

""

"" "" "" (or "" ")  

Boolean value

true,1

false,0

2. Collection:

List

Meta-group

Dictionary

Collection (hash table)

Six, circulation

For

While

Python day1: first knowledge of Python

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.