from kivy.storage.jsonstore import JsonStore
store = JsonStore('file name.json')
# put some values
store.put('tito', name='Mathieu', org='kivy')
store.put('tshirtman', name='Gabriel', age=27)
# using the same index key erases all previously added key-value pairs
store.put('tito', name='Mathieu', age=30)
# get a value using a index key and key
print('tito is', store.get('tito')['age'])
# or guess the key/entry for a part of the key
for item in store.find(name='Gabriel'):
print('tshirtmans index key is', item[0])
print('his key value pairs are', str(item[1]))
您可以使用Json文件。开发人员建议使用JsonStore,保存到txt不知何故不是很好。此外,如果您想将应用程序传输到移动设备,它将更易于使用
More information
相关问题 更多 >
编程相关推荐