postoption=input("Press 1 to leave a post, and 2 to close The Wall.")
if postoption=="2":
print("Wall closed.")
elif postoption=="1":
wally=pickle.load(open("The Wall.txt","rb"))
usernamey=pickle.load(open("username1.txt","rb"))
wu="\n",(wally),"\n",(usernamey)
apost=input("Enter your post below: \n")
pwickle=pickle.dump((wu, apost), open("The Wall.txt","wb"))
print(pwickle)
else:
print("Wall closed.")
此代码将保留“\n”而不是新行,因为它正在重新读取.txt文件中保存的内容。什么是阻止这一切的最简单的方法?在
目前没有回答
相关问题 更多 >
编程相关推荐