Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
post=input(str("Enter your post below: \n")) addpost=pickle.dump(post, open("The Wall.txt","ab")) print(addpost)
不知道为什么此代码返回“无”而不是输入的内容...
因为pickle.dump将对象写入文件,并返回None.
pickle.dump
None
你可能想要
addpost = pickle.load(open("The Wall.txt", "rb"))
反而。