机器学习之python基础10

“”"
操作文件的步骤:
1打开文件2读写文件3关闭文件
用到1个函数open3个方法read,write,close
先写open,close在写read和write
“”"
file=open(“readme.txt”)#默认是以只读文件的形式并且返回对象,resdme中不能含有中文否则报错
text=file.read()
print(text)
print("*"*50)
file.close()

猜你喜欢

转载自blog.csdn.net/weixin_43247522/article/details/84798867
今日推荐