一篇文章带你搞懂Python的文件读写播

Posted on 2022-05-18 10:06  风行天下-2080  阅读(31)  评论(0)    收藏  举报

1、

https://baijiahao.baidu.com/s?id=1700963066474006538&wfr=spider&for=pc

https://www.runoob.com/python/python-files-io.html

 

 

 

#!/usr/bin/python
# -*- coding: UTF-8 -*-
 
# 打开一个文件
fo = open("foo.txt", "r+")
str = fo.read(10)
print "读取的字符串是 : ", str
# 关闭打开的文件
fo.close()

 

 

2、

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3