Commit 6bcab784 by BellCodeEditor

save project

parent 8c634aa2
import ch
while True:
xuan =input("请选择对文件的打开方式:(a:追加,r:读取,q:退出)")
if xuan == "a":
ch.write_one()
if xuan == "r":
ch.read_one()
if xuan == "q":
break
\ No newline at end of file
def write_one():
while True:
yonghu=input("用户请输入<你想写的内容(注:退出请输入q):")
if yonghu =="q":
break
else:
with open(r"C:\Users\Think\Desktop\er.txt","a",encoding="utf-8")as a_one:
a_one.write(yonghu+"\n")
def read_one():
with open(r"C:\Users\Think\Desktop\er.txt","r",encoding="utf-8")as b_one:
read_raed_one=b_one.read()
print(read_raed_one)
# a=pen("C:ers\Think\Desktop\er.txt","w",encoding="utf-8")
# a.write("re")
# a.close()
with open(r"C:\Users\Think\Desktop\er.txt","a",encoding="utf-8") as a:
a.write("小黄:890本\n")
a.write("小绿:880本\n")
a.write("小兰:0本\n")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment