One, Python is a kind of language:
Programming language Categories:
Compiled type:
Interpreted type: slow execution;
Dynamic Language: Checks the data type during run time without assigning data types to any variables;
Static language: Check the data type during compilation;
Strongly typed definition language: Enforces the language of data type definition, slower, more rigorous;
Weak type definition language: The data type can be ignored language, a variable can be assigned to different data types of values;
Python is a strongly-typed definition language with dynamic interpretation.
1. Advantages:
Simple, high development efficiency, has very powerful third-party library, high-level language, portability, extensibility, embeddable;
2. Disadvantages:
Slow, code can not be encrypted, the thread can not take advantage of multi-CPU (GIL);
Python interpreter: CPython IPython pypy Jython IronPython
. py File Execution:
Python2 or Python3:
Difference: Support Unicode,print ()
Ii. Getting started with Python:
1. The first Python program:
Print ("Hello world!")
#Linux上执行遇到问题: File format problem, use command Dos2unix helloworld.py conversion.
[Email protected] ~]#./helloworld.py
: No file or directory
#解决:
Open the Sh file with vim and enter:
: Set FF
Enter, display Fileformat=dos, reset the following file format:
: Set Ff=unix
Save exit
2. Variables and character encodings:
Variables: saving data, in order to invoke;
Define a rule: variable names can only be any combination of letters, numbers, or underscores, the first word Fu Bu is a number
Character encoding and binary:
The numbers are converted into binary;
The string is converted into binary;
ASCII: A maximum of 8 bits (one byte) can be represented in 8bit
English: GB2312, GBK (common), GB18030
Unicode (Uniform Code, universal Code, single code):
Comments:
Multiple lines: ' Here is the note '
Single line: # "" "
3. User interaction Program:
Name = Input ("username:") #一切输入都是字符str
Week1-python Introductory Tutorial (later in the perfect)