您的位置:首页 > 编程语言 > Python开发

There are eight key elements of python

2016-06-20 16:10 579 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: