From 1a3844776b01737e5b681e98579fe189407652af Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Thu, 2 Feb 2023 15:40:59 +0800 Subject: [PATCH] save project --- diy.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/diy.py b/diy.py index 67309f3..fea45f6 100644 --- a/diy.py +++ b/diy.py @@ -1,4 +1,9 @@ # 写入同学们的1捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本' -a=open(r"D:\桌面\新建文本文档.txt",'a',encoding='utf-8') -a.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本\n') -a.close() \ No newline at end of file +# a=open(r"D:\桌面\新建文本文档.txt",'w',encoding='utf-8') +# a.write('小兰:12本,小丽:11本,李文:9本,张伟:16本') +# a.close() +with open(r"D:\桌面\新建文本文档.txt",'a',encoding='utf-8') as a: + a.write("abcdefghijklmnopqrstuvwxyz\n") +with open(r"D:\桌面\新建文本文档.txt",'r',encoding='utf-8') as a: + n=a.read() + print(n) \ No newline at end of file -- libgit2 0.25.0