f=open("foo.txt")
for line in f:
print (line)
f = open("data.txt","r") #设置文件对象
st= f.read() #将txt文件的所有内容读入到字符串str中
f.close() #将文件关闭
python 读取txt
阅读 123
2023-01-13
f=open("foo.txt")
for line in f:
print (line)
f = open("data.txt","r") #设置文件对象
st= f.read() #将txt文件的所有内容读入到字符串str中
f.close() #将文件关闭
相关推荐
精彩评论(0)