1 Star 0 Fork 0

陈雨/Python代码练习

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
code-写入文件.py 322 Bytes
一键复制 编辑 原始数据 按行查看 历史
陈雨 提交于 2024-08-02 18:03 +08:00 . python文件操作
# 以写入的方式打开文件
f = open('test.txt', mode='a', encoding='utf-8')
# 写入
write_date = ['你收啊', '服务器', '客户端', 'socket']
for i in write_date:
f.write(i + '\n')
# 关闭文件
f.close()
fr = open('test.txt', mode='r', encoding='utf-8')
read_date = fr.read()
print(read_date)
fr.close()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mutong-chen/python-code-practice.git
git@gitee.com:mutong-chen/python-code-practice.git
mutong-chen
python-code-practice
Python代码练习
master

搜索帮助

371d5123 14472233 46e8bd33 14472233