python笔记:2.5文件IO

# -*- coding: utf-8 -*-
"""
Created on Wed May 15 15:48:06 2019

@author: User
"""

path = 'd:/a1.txt'
f = open(path, 'r+')
print(type(f))
print(f.mode)
print(f.name)
print(f.closed)
print(f.read(10))
print(f.read(10))
print(f.read(10))
#print(f.readlines)
f.close()
print(f.closed)

运行:

<class '_io.TextIOWrapper'>
r+
d:/a1.txt
False
中国三大航均为国有,

它们的潜在力量不可
小视。
航空数据供应
True
 

上一篇:ssh failed sometimes after connection established: server unexpectedly closed network connection


下一篇:Java 8 新特性