标签:different following sometimes elements methods
1. data type
2. variant
grammer: objectReference = value
‘=‘ means bind a variant with object in memory.
variant name is case sensitive in pyhon.
3. combination data type
major types are meta and list
meta is fixed.
list is changable.
#x.append(xxx) == list.append(x,‘xxx‘)
There are two call methods in python. as following.
functionName(arguments)
objectName.methodName(arguments)
4. logical operator
sometimes "is" will give you a different result. in fact. its compared with memory object.
0<=a<=10 equal a>=0 and a<=10
"in" is better used in dict
5. control
a.
if boolean_expression1:
suite1
elif boolean_expression2:
....
else:
else_suite
b.
while boolean_expression:
suite
c.
for variable in iterable:
suite
6. mathmatic
list must use iterable object.
e.g. seeds+=5 # will get error
seeds+=[5] #correct
7. IO
try:
...
except ValueError as err:
print(err)
continue
except EOFError:
break
8. function
def functionName(argument1,a2,a3...):
suite
There are eight key elements of python
标签:different following sometimes elements methods
原文地址:http://luluuy.blog.51cto.com/279347/1791041