python sentence
2016-03-28 12:59
357 查看
1、while for 增加了循环正常结束后执行的else代码块。
2、Objects are mutable
3、import copy
p1 = Point()
p2=copy.copy(p1) # this operation is called a shallow copy because it copies the object and any references it contains, but not the embedded objects.
p3=copy.deepcopy(box) # deepcopy copies not only the object but aslo the objects it refers to.
p1 is p2 False
p1 == p2 False
the default behavior of the == operator is the same as the is operator; it checks object identify, not object equivalence.
4、if you try to access an attribute that doesnot exist, you get an AttributeError
type(p)
isinstance(p, Point)
hasattr(p, 'x')
2、Objects are mutable
3、import copy
p1 = Point()
p2=copy.copy(p1) # this operation is called a shallow copy because it copies the object and any references it contains, but not the embedded objects.
p3=copy.deepcopy(box) # deepcopy copies not only the object but aslo the objects it refers to.
p1 is p2 False
p1 == p2 False
the default behavior of the == operator is the same as the is operator; it checks object identify, not object equivalence.
4、if you try to access an attribute that doesnot exist, you get an AttributeError
type(p)
isinstance(p, Point)
hasattr(p, 'x')
相关文章推荐
- Windows下安装mysql-python
- python 安装scikit-learn库
- 【Python】日期模块总结
- Python数据分析-索引和选择数据
- 【Python】Django filter 如何支持 or 条件过滤?
- python在windows平台的pip安装package时的编译问题
- 【Python】Django auth 修改密码如何实现?
- Python3.x 生成exe文件
- Python-Requests模拟登录-实现图书馆座位自动预约
- Python 练习册,每天一个小程序(0000)
- python笔记---正则表达式
- pip install mysql-python fails with EnvironmentError: mysql_config not found
- python 2进制,8进制,10进制,16进制转换
- Python 读取网页内容 乱码问题
- Python常用的爬虫技巧总结
- Python对数据库操作
- python 小模块
- Numpy库进阶教程(一)求解线性方程组
- 从Python中看约定俗成的一些编程习惯
- python 实现SVM向量机代码