Python 0 Basic Learning-basic knowledge 1-python Introduction

Source: Internet
Author: User

Programming language Classification Method 1:

    • Compile type: such as c,c++, write code as source file, to edit build executable file to execute
    • Interpreted type: Like VBS, Python does not need to compile, use the interpreter to execute, better executable; Java uses a compromise between the two, compiling the generated file is still dependent on the interpreter execution, so it belongs to the explanatory language

Programming language Classification Method 2:

    • Dynamic type language: No need to specify variable types such as Python, Ruby, VBS, etc.
    • Static type language: Check variable types at compile time, such as C, C + +, Java, C #

Programming language Classification Method 3:

    • Strongly typed definition language: Variable types cannot be changed, such as Python, Java
    • Weakly typed definition language: can be transformed, such as VBS

Python: Strong typing, dynamic, interpreted scripting language

Advantages:

    • Powerful class Library
    • No need to consider issues such as memory release
    • High portability

Disadvantages:

    • Slower running speed
    • Code cannot be encrypted
    • Threads cannot use multi-CPU, that is, the multi-core advantage cannot be exploited

code file format: xxx.py

Python interpreter:

    • CPython: The most widely used interpreter
    • IPython
    • PyPy: Fast, using JIT to dynamically compile Python
    • Jython
    • IronPython

Python developed from 2 to 3 the most important changes: 3 Unicode support

Download Install: https://www.python.org/downloads/

Configure the environment variable: please baidu by yourself

Execution mode:

    • Enter Python in cmd
    • Save the py file, cmd into the path, Python xxx.py
    • When Linux executes, declare the interpreter first, for example: #!/usr/bin/env python

Python2 default encoding: AscII

Python3 Default code: UTF-8

You can manually declare a character set: Enter #-*-Coding:utf-8 in the first line-*-

Character encoding table past life

    • Start, only ascii:only for English letters and some special characters, 1 characters in 1byte
    • Later, with the GB2312: included 7k+ kanji
    • Later, with the GBK: more included 2w+ Chinese characters
    • Later, with the GB18030: more Chinese characters included
    • Later, the unified standard is Unicode, with one character occupying 2 bytes
    • Later, with Utf-8, a subset of Unicode, English accounted for 1 bytes, Chinese 3 bytes

Python 0 Basic Learning-basic knowledge 1-python Introduction

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.