Python 文件处理 file 与 open 的区别与注意
2013-07-18 16:47
375 查看
来自论坛 : (不保证正确性)
有区别吧,一个是类构造,一个是内建函数,虽然open的实现可能就和下面的差不多
def open(filename, mode='r'):
return file(filename, mode)
它说地很清楚了,推荐使用open
可能linux环境对file支持不好,所以保险起见,还是遵循文档中所说的,坚持用open方法吧。
有区别吧,一个是类构造,一个是内建函数,虽然open的实现可能就和下面的差不多
def open(filename, mode='r'):
return file(filename, mode)
它说地很清楚了,推荐使用open
可能linux环境对file支持不好,所以保险起见,还是遵循文档中所说的,坚持用open方法吧。
相关文章推荐
- Python 文件处理 file 与 open 的区别与注意
- Python中file()和open()的区别
- Python 用file 对象和open方法处理文件的区别
- Python的file()和open()方法的区别
- Python中open函数注意点
- 新转移注意(caffe):ImportError: libcudart.so.7.0: cannot open shared object file: No such file or directory
- Python中获取路径os.getcwd()和os.path.dirname(os.path.realpath(__file__))的区别和对比
- python file not open for writing
- python连接mysql数据库时报错:import _mysql ImportError: libmysqlclient.so.18: cannot open shared object file:
- 在python下file类型、open方法
- python3.5: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory
- python的os.path.realpath(__file__),os.getcwd(),sys.path() 的区别
- 安装MySQL-python报错:_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory或者 build\lib.win-amd64-2.7\_mysql.pyd : fatal error LNK1120: 56 unresolved externa
- 零基础学python-2.17 文件、open()、file()
- 解决error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No su
- linux文件描述符open file descriptors与open files的区别
- win7 64 安装mysql-python:_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': N
- 文件操作注意事项 分类: python 小练习 python基础学习 open()文件读写 2013-12-03 11:05 532人阅读 评论(0) 收藏
- Python中获取路径os.getcwd()和os.path.dirname(os.path.realpath(__file__))的区别和对比
- 安装pymysql、mysql-python 安装错误 fatal error C1083: Cannot open include file: 'config-win.h':