Python学习笔记:文件操做、异常处理、JSON

读文件 file_object = open(filename) 打开filename文件,返回该文件的对象 file_object.close() 关闭文件 with open(filename) as file_object: with会在在不须要访问文件后将其关闭 注意with行末尾也要跟着: file_object.read() 把文件内容读取成一串字符串 file_object.read
相关文章
相关标签/搜索