The difference between a compiled language and an interpreted language 1. Compiler language Features: Portability is poor, running fast. 2. Interpretive language: Features: Side execution side translation; slow speed. ---------------------------------------------------------Ii. Advantages and disadvantages of Python 1. Elegant and simple 2. The development efficiency is high, the library file is many. 3. High-level language, no need to consider managing underlying memory. 4. Cross-platform, lesson extension. 5. can be embedded. Cons: Slow, code cannot be encrypted. Threads cannot take advantage of multi-CPU issues. --------------------------------------------------------------three, the use of the interpreter is most commonly used CPython and pypy. -------------------------------------------------------------Four, Python history----------------------------------------------------------------------------------------------------------Five , variable variable definition: A container meaning for storing data in memory: The intermediate result or state that the program executes is saved for subsequent code invocation. Variable name: (Cannot start with a number, cannot have spaces and special characters) is recommended to be underlined with similar age_of_oldboy. --------------------------------------------------vi, constant (all uppercase letters) Age_of_oldboy =------------------------------- ------------seven or two binary and bit bit a binary number = 1 bit bit = The smallest storage unit of the computer. 8 bit bit = 1bytes byte life: 1 B is 1bytes, 1b is 1bit eight, character encoding set universal encoding set unicode 4bytesutf-16 = 65535 2**32 4bytesutf-8python2.x, the character set needs Declaration, default 2.0 does not support Utf-8, Windows default character set is gbk #-*-coding:utf-8-*- notepad++ default GBK is ANSI-----------------------------------------------------Nine, Python notes in Pycharm, you can use CTRL +? Bulk comment Multiple lines, single-line comment with #, multiline comment three quotation marks. Description: There is no difference between single and double quotes in Python. Single-double-quote strings can only be in the same row, and if one string is multiple lines, three quotation marks are required. Raw_input in python2 = input in Python3 input2 () If you enter a string, you need to use quotation marks, and if there is no quotation marks, you enter a variable. ------------------------Pycharm: Multi-line Check tab indent, multi-line check shift+tab cancel indent. -----------------------@ the same level of code, indentation must be consistent. work: Learn to expand:< formatting String Functions Str.format () > syntax: by using {} and: Instead of% three usage: 1. By Location >> > ' {0},{1} '. Format (' KFC ', ' kfc,59 ') ' >>> ' {},{} '. Format (' KFC ', ' I ') ' kfc,59 ' >>> ' {1},{0},{1} '. Format (' Kzc ', +) ' 18,kzc,18 ' 2. Through object properties (not quite understood for the time being) http://www.jb51.net/article/63672.htm3. by subscript >>> p=[' Kzc ',18]>>> ' {0[0]},{0[1]} '. Format (P) ' kzc,18 '
Python-day 1