import pickle

with open("school_info","wb") as school:
    user_input = str(input("请输入学校的名字:"))
    if len(user_input.strip()) > 0:
        pickle.dump(user_input,school)

上面是pickle的dump方法

with open("school_info","rb") as school:
    data1 = pickle.load(school)
    print(data1)

这是pickle的load方法

相关文章:

  • 2022-12-23
  • 2021-06-29
  • 2021-09-22
  • 2021-06-13
  • 2021-07-06
猜你喜欢
  • 2021-10-18
  • 2022-03-07
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案