1.Python Introduction
Python is a programming language written by the famous "Uncle Turtle" Guido van Rossum during Christmas 1989 to send a boring Christmas.
Python is an interpreted language.
Interpreted language: The program is run by an interpreter, a read-only interpretation of the execution.
Python program execution process: source code =====>> bytecode file ======>> interpreter ======>> machine code.
Python is divided into 3.X and 2.X versions, and two versions are incompatible with each other.
2.Python Installation
Download:https://www.python.org/downloads/
To facilitate subsequent use, the installation path is best chosen c:python35
Set the environment variable when installing, or set it to the system after installation
3.Python Getting Started 3.1 file header
#!/usr/bin/env python 针对Linux系统,指定Python解释器
# -*- coding: utf-8 -*- 指定字符编码3.2 Comment Line comment For # Multiline comment for ' ' ' Comment content ' ' 3.3pyc file
When you execute Python code, if you import a different. py file, a. pyc file with the same name is automatically generated during execution, which is the bytecode generated after the Python interpreter was compiled.
PS: Code is compiled to generate bytecode, and bytecode can be obtained by decompile.
3.3 Variables
Consists of letters, numbers, and _, which cannot begin with a number, and cannot be used as a variable name.
Python-defined variables do not require a declaration type, variables that are not declared cannot be referenced directly
4. Input and output
Python2 input has raw_input (), parse all input into a string, enter a string with quotation marks, input () resolves to integer, float, string, etc. based on input content
Python3 input has only input (), all inputs parse to string, input string is not quoted
Python2 output print "Output content"
Python2 output print ("Output content")
5. Operators
+: Add
-: Minus
*: Multiply
/:python2 divisible, Python3 will not have a decimal
: Floor Except, (Do Python3)
%: Take remainder
* *: Power operation
= =: judging equality
! =: Not equal to
<: Less than
: Greater Than
<=: Less than or equal to
>=: greater than or equal to
Python full stack _python base _day1