1. 字符串转换成字典
import json user_info= '{"name" : "john", "gender" : "male", "age": 28}' user_dict = json.loads(user_info) user_dict # {u'gender': u'male', u'age': 28, u'name': u'john'}
2. 使用csv写入文件
import csv f = open("./data/api.csv",'w+',encoding='utf8',newline='') writer = csv.writer(f) writer.writerow([ "Device Specific", "Restricted Access ( Requires Provider Approval )", "SSL Support" ]) f.close()
标签:文件,处理,writer,28,json,dict,user,csv From: https://www.cnblogs.com/cciscc/p/16728050.html