关于list:

1)写入文件

      

self.existedBlog.write("your item data" + "\n")

2)读取

   

3)文件内容:

self.existedBlog = open("existedBlog", "r+")

        self.existedBlog.seek(0)

        currentBlogs = self.existedBlog.readlines()        print(currentBlogs)

     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":"",