Python full Stack Road 1 basic Introduction to Python

Source: Internet
Author: User

In the context of Python encoding python2.x, the default is ASCII encoding mode python3.x, the default is Unicode encoding mode   about Python interpreter  CPython   There are many    python interpreters, but the default is only Python's own CPython interpreter. CPython is also the most widely used Python interpreter  ipython     ipython is based on an interactive interpreter on the CPython, which means. Ipython is only enhanced in interactive mode, but the function of executing code is exactly the same as CPython.  PyPy     pypy is another Python interpreter whose goal is execution speed, pypy using JIT technology to dynamically compile Python code (not explained), So you can significantly improve the execution speed of Python code.   The vast majority of Python code can be run under PyPy, but PyPy and CPython are somewhat different, which results in the same Python code being executed under both interpreters. PS: If your code is to be executed under PyPy, you need to understand the differences between PyPy and CPython.  Jython     jython is a Python interpreter running on the Java platform that can be directly compiled into Java bytecode execution.  IronPython     ironpython and Jython are similar, except that IronPython is running on Microsoft. NET platform, you can directly compile the Python code. NET byte-code.  python's interpreter is vicious, but the most widely used is CPython, if you want to be with Java or. NET platform interaction, the best approach is not to use Jython or IronPython, but to interact via network tuning to ensure the independence of each program.   python program execution Process:  python code (. py) is compiled into bytecode, then to the bytecode virtual machine, and then a virtual machine to execute a byte code instruction, to complete the execution of the program.   What is a byte code?       bytecode in Python virtualThe corresponding Pycodeobject object in the machine program. The      .pyc file is a representation of the bytecode on disk. &NBSP;PYC file      pycodeobject objects are created when the module is loaded, that is, import     python test.py compiles the test file into bytecode and interprets execution, but does not generate test.pyc      If test.py loads other modules such as import util, Python compiles the util.py into bytecode, generates UTIL.PYC, and executes the bytecode interpretation.       If you want to generate TEST.PYC, we can compile using Python's built-in module Py_compile.       When the module is loaded, if both. py and. Pyc,python will try to use. PYC, if the. PYc is compiled earlier than the. Py modification time, recompile the. py and update. Pyc pycodeobject      python Code compilation result is the Pycodeobject object.    day1 for Statements     &NBSP;FOR is a looping statement, typically used for counting forms of loops. For example, to derive the sum of the numbers between 1~100, you can use for:     for I in range (+):          SUM + = i while statements &N Bsp The   &NBSP;WHILE loop structure can determine whether the loop structure executes or not, depending on the state of the expression, which can be either 1 or an expression. such as:     while true: # Permanent for true, loop constantly. Use break to jump out of the loop.      while a < b: #表达式, depending on the result of the expression is true or false determines whether the loop structure is executed.  if Statement       Conditional judgment statement, if is generally used for comparison operations, if the conditional expression evaluates to the specified value or the corresponding value executes the IF languageThe code inside the sentence structure. If there are multiple structural forms: if:     else: if expression:     elif expression:     Else: elif If the IF expression is not true, skip to the branch Round judgment, else     If other judgment statements are not true, then the corresponding code is transferred to that branch.  python character encoding: In a 3.x environment, the character default encoding is utf-8. If you need to convert to another encoding you can use encode () and Decode () encode () is a character encoding function, you need to specify what encoding to encode decode () is a character decoding function that needs to specify what the original encoding   for example: temp = "Li Jie" temp_gbk = Temp.encode (' GBK ') print (TEMP_GBK)    job: 2 weeks to complete 1 summary knowledge points to blog 2 Complete Calculator function 3 Complete function recursion, read socketserver source, and complete it  python operator +      addition operation-    subtraction operation/    Division operation *       multiplication operation *     POWER operation//    floor except, return quotient part  and     and operation or     OR operation not     non-op in     member operation, such as a = [1,2,3,4, "Hello"]  if "Hello" in A:not in member operation, in reverse Operation &NB Sp;python Basic type: Numeric type int  character type str  Boolean type bool  special type none, none is not empty, but a special type. Meaning   placeholder in string application:     s = "Hello {0},your age is {1}"   In this case the {} curly braces in the string play the role of a placeholder, You can format the data in using the Format function.      s = s.fOrmat ("Alex", >>>shello Alex,your is 19 

Python full stack path 1 Python basic introduction

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.