🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
Python的list,dictionary可以写入file, 也可以从file中读取。 关于list: 1)写入文件       self.existedBlog.write("your item data" + "\n") 2)读取       self.existedBlog = open("existedBlog", "r+")        self.existedBlog.seek(0)        currentBlogs = self.existedBlog.readlines()       print(currentBlogs) 3)文件内容:    line1    line2    line3    line4     关于dictionay: 1)写入文件         import json                  dict['authToken'] = "your dev auth token" > file = open('config', "w+") > writer = json.JSONEncoder() > print(writer.encode(dict).strip("{}")) 2)读取       import json       input_text = open('config').read()        input_json = "{%(input_text)s}" % vars()        reader = json.JSONDecoder()        config = reader.decode(input_json)        print(config)   3)文件内容:   "authToken":"your dev auth token",   "noteStoreUrl":"your store",   "blogType":"your blog api",   "username":"",   "password":"",