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
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
相关文章推荐
- python爬虫:将本人博客园文章转化为MarkDown格式
- Python的伪私有属性
- python第一章
- Python 学习笔记(for循环)
- python virtualenv 需要使用系统的第三方包。
- python学习
- python py转换为exe
- Python如何多次遍历文件及查找特定文件
- Python中Iterator迭代器的使用杂谈
- python基础之内置模块(二)
- Python爬虫实践(四):一些不常用设置
- 初识python
- 303. Range Sum Query - Immutable [easy] (Python)
- 实例讲解Python编程中@property装饰器的用法
- 广东海洋大学 电子1151 孔yanfei python语言程序设计 第十二周
- 广东海洋大学 电子1151 孔yanfei python语言程序设计 第十一周
- 广东海洋大学 电子1151 孔yanfei python语言程序设计 第十周
- 广东海洋大学 电子1151 孔yanfei python语言程序设计 第九周
- 广东海洋大学 电子1151 孔yanfei python语言程序设计 第七周
- Flask at Scale (Flask如何适配到大型应用) - PyCon 2016 简明中文翻译