1. Programming Language:
Machine code-"microcode becomes-" high-level language
compiler [Interpreter]: Transform what humans can understand into machines that understand
Compiler: Must be converted to binary code to run
Interpreter: Side explanation [Execute], side run
Python is very close to the way humans think.
Python can also be understood as a scripting language, but more powerful than a scripting language
Also suitable for the development of large programs, but also a complete language
Python for automated operations: overqualified
Python has a lot of frames: Web,django, etc.
Python defects:
Slow first execution {First compile into bytecode bytecode}, second faster
Lower execution efficiency than c,c++, but high development efficiency
Pvm:python virtual Machines
2.python Execution Process:
PVM: The whole process needs to be aided by
Source code----->complier------>bytecode----->interpreter--->processor
. py format. PYc format
OpenStack was developed in Python.
Implementation of the 3.Python
CPython: Primitive, standard way of implementation
Jython: Implementation for Java language integration
IronPYthon: for use with. The implementation of NET Framework integration
Python interpreter implemented by Pypy:python
4.Python Performance Optimization tool:
An extension module of the Psyco:python language, which allows the program code to be optimized in a professional manner.
Can improve the execution speed of the program to a certain extent, especially when there are a lot of cyclic operations in the program
The current development has been discontinued and replaced by PyPy
PyPy: Python interpreter implemented by Python: PyPy's icon is particularly interesting, and a python bites its own tail.
Dynamic compiler for Python language, a successor to Psyco
Can run in linux,32,64,macosx,windows-32
Shed Skin:
Python compiler, capable of translating Python code into optimized C + + code
How to use Python:
1. Interactive python: Enter command Python and execute only once
2.python File: Save the program you have written to (. py) to run multiple times,
Python's program files, which contain a series of pre-written statements, are called "modules"
A module file that can be run directly is often called a script (the top-level file of a program)
such as Vim,
Each file is called a module and can be called.
Top-level file-as the execution entry for the entire program
3. Or use the IDE: integrated development environment
Python implements self-testing in submodules, rather than invoking implementation tests in the top-level file
The first Python program
a.py
#!/usr/bin/python//shebang, which is the interpreter that notifies the content to start when executing a script
Import Platform//imports a Python module via import platform
Print platform.uname ()//Printing Platform Module execution results of the Uname method
chmod +x a.py
./a.py
Compatibility between Python V2 and V3 is particularly poor
Python v2 High prevalence
Python programs can be decomposed into modules, statements, expressions, and objects
The program is composed of modules
Module contains statements
Statement contains an expression
expression creation and processing of an object
The expression is "something", and the statement is "doing something (i.e. instruction)";
For example, "3+4" is something, "Print 3+4" is doing something
Statement attributes: They change things, for example, assignment statements change variables, Print statements change screen output, and so on:
5.python Objects
Everything in Python is an object, and a variable is an object.
Process oriented:
Command-centric, processing of data by instructions
How to organize code to solve problems
Process oriented: {More and solve complex problems}
Data-centric, all processing code is expanded around the data
How to design data structures and provide the processing operations that are allowed for such data
Python all supports
Python
>>> Import Platform
>>> dir (Platform)//view platform's built-in parameters
If you want to use:
A later version of Python, the original 2.6.6 can not be unloaded arbitrarily,
Method:
1. Compile and install the new version to the specific road strength
2.pyenv, can install,uninstall, and switch//self-understanding
3.
Method One: python-2.7.6.tar.gz, ipython-1.2.1.tar.gz
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
wget http://archive.ipython.org/release/0.12/ipython-0.12.tar.gz
Unzip,./conigure--help
Python relies on Readline-devel,python interactive mode back-delete can be used//other to write
./configure--pfefix=/usr/local/python27
Make && make install
Ipython must be compiled using Python, Ipython for example, auto-complement function
/usr/local/python27/2.7/python2.7 You can use commands
Installing Ipython
Unzip and enter the Ipython directory
/usr/local/python27/bin/python2.7 setup.py Build//Compile
/usr/local/python27/bin/python2.7 setup.py Install//installation
Link command:
Ln-sv/usr/local/python27/2.7/usr/bin/python27
Ln-sv/usr/local/python27/bin/ipython/usr/bin/ipython
Enter Ipython command test
Test completion function
============================================================
Note: Never move the default Python version of the system
program = data structure + algorithm
program = instruction + code
The most basic data structure of Python is the sequence
Each element in the sequence is assigned an ordinal-that is, the position of the element, and also the index, which is numbered starting at 0.
Python contains 6 built-in data series: list, tuple, string, Unicode character, buffer object, and Xrange object
============================================================
Getting Started with Python (i)