1. Python physical implementation.
IronPython: driven by Microsoft and driven by DRL Dynamic Language. No common Python third-party class libraries are supported. Latest Version: 2.7. Under study.
CPython: standard version.
StackLess: unlimited stack version.
JPython: Based on Java, WAS is used as a configuration file (indeed, it is very useful ). I heard that there is a Django version.
2. Python compares the syntactic sugar of other static languages.
Supported keywords: and (&) or (|) not (!)
3 <4 and 4 <5 abbreviation 3 <4 <5
Value assignment statements ++ and --
Python supports the int long bool float complex (negative) decimal Integer type in 6 by default.
Decimal is used to support 1.1 and decimal. Decimal ('1. 1') is 1.10000001.
String slicing:
Pystr = 'geewu hello world'
Pystr [0]
Pystr [2: 5]
Pystr [: 2]
Pystr [3:]
Pystr [-1] The last letter
Pystr [:-2] pystr [start: end: Step]
Built-in list and metadata, as well as dictionaries
List aList = [123123,] tuple = (,) the dictionary aDist = {"hello1": '20140901'} cannot be modified '};
For Loop + range () built-in Function
For item in [1, 2, 3] is equivalent to for item in range (1, 3)
Enumerate () method
Foo = 'abc'
For I in range (len (foo): equivalent to for I, ch in enumerate (foo ):
Print foo [I], '(% d)' % I print ch, '(% d)' % I
List Parsing
Squared = [x ** 2 for x in range (4)]
For I in squared:
Print I
Squared = [x ** 2 for x in range (4) if not x % 2]
For I in squared:
Print I
Special continuation symbol (\)
# Check Condition
If (weather_is_hot = 1) and \
(Shark_warning = 0 ):
Send_goto_beach_mesg_to_pager ()
Function iskeyword () for determining special keywords ()
Common Tools
Debugger: PDB.
RECORDER: logging.
Performance tester: profile, hostshot, cprofile
Python built-in object.
The default value is none. The Boolean value is always false.
Are all false objects.
None, False, all 0 values, 0, 0.0, 0L, 0.0 + 0.0j, ''," ", [], (), {}
Id () obtains the location of the declared variable. a is B is equivalent to id (a) = id (B)
If type (num) is types. IntType