1.
Http://docs.python.org/dev/3.0/whatsnew/3.0.html
Python-announce-list
Python-help
2.
Interactive compiler
3.
Non-integer division
.1.
>>> From__future__import Division
Syntaxerror:invalid syntax
.2.linux-qnew
4.
Integer division//is a floating-point number that also performs the divide
Take the surplus 2.75%0.5
Power operator * * (POW (base,times[mod]))
The power operator is higher than the inverse level
Round () is approximately an integer
ABS () absolute value
Math.floor ()
Math.ceil (()
5.
Octal 010 Expression canceled
6.
Print () Print is changed to function
7.
X=input ("The Meaning of Life")
Raw_input:raw_data
8.
If 1==2:
9.
Built-in functions
Calling functions
10.
Import Math
From math import sqrt
foo = math.sqrt; Foo (4)
11.
>>> sqrt (-1)
Traceback (most recent):
File "<pyshell#23>", line 1, in <module>
sqrt (-1)
Nameerror:name ' sqrt ' is not defined
12.
>>> cmath.sqrt (-1)
1j
13.
__future__
14.
#! /usr/bin/env python
Or
#! /usr/bin/python2
15.
chmod a+x hello.py
16.
Comment #
Thou Shalt Comment
17.
String
Automatic stitching
"", "", "" "(Long)," "" "" "(long) delimited
STR1 + str2
STR (): Converts a value into a reasonable form of a string
Repr (): Display in a legal Python expression (or ' (python3.0) no longer in use)
18.
Raw_input (' press<enter> ')
The. Pyw format is unresponsive
19.
Print R ' \ c '
Raw string
20.
Unicode string
U ' c\: '
21st.
Int (object)
Long (object)
Help ()
2.1
Sequence
Python contains 6 built-in sequences, lists, tuples, strings, Unicode strings, buffer objects, xrange objects
List can be modified, tuples cannot, only tuples are used as keys to dictionaries
2.2
Edward = [' Edward ', [' John ', ']
John = [' Johns ', ']
database = [Edward, John]
2.3
Container {sequence, map, collection ...}
2.4
Index, negative index
' hello ' [1]
Raw_input (' Year: ') [3]
Shard, add, multiply, verify membership, calculate sequence length, find maximum/minimum
2.5
X=input (" ' Hello world!! What ' s your age? ")
Print ("Your", x)
months = [
' Jan ',
' Feb ',
' March ',
' April ',
' may ',
' June ',
' July ',
' endings ',
' Sep ',
' Oct ',
' Nov ',
' Dec ',
]
= [' st ', ' nd ', ' rd ']+17*[' th ']\
+[' st ', ' nd ', ' rd ']+7*[' th ']\
+[' St ']
Year = input (' year: ')
month = input (' month: ')
Day = input ("Day:")
Month_ Number = Int (month)-1
Day_number=int (Day)-1
Month_name = Months[month_number]
Ordinal=day+endings[day_ Number]
Print (month_name+ ' +ordinal+ ', ' +year)
2.6
Shard
Numbers[begin:end:steplong]
Begin,end can be empty, Steplong cannot be 0, when negative numbers are extracted from left to right
Python Basic Tutorial Notes unit 1th && Unit 2nd