0
辞書をUnQLiteデータベースに保存したいので、後で使用することができます。文字列としてしかしUnQLite店舗それは:Python:UnQLiteで辞書を保存するには?
>>> from unqlite import UnQLite
>>> db = UnQLite()
>>> db['dict'] = {'a': 5}
>>> db['dict']
"{'a': 5}"
辞書をUnQLiteデータベースに保存したいので、後で使用することができます。文字列としてしかしUnQLite店舗それは:Python:UnQLiteで辞書を保存するには?
>>> from unqlite import UnQLite
>>> db = UnQLite()
>>> db['dict'] = {'a': 5}
>>> db['dict']
"{'a': 5}"
私はその後、彼らのネイティブ型でデータを取得collection
を使用することができることを考え出しました。
>>> from unqlite import UnQLite
>>> db = UnQLite()
>>> colors = db.collection('colors')
>>> if not colors.exists():
... colors.create()
...
>>> colors.store([{'name': 'red', 'code': '#ff0000'}, {'name': 'green', 'code': '#00ff00'}])
1
>>> colors.all()
[{'code': '#ff0000', 'name': 'red', '__id': 0}, {'code': '#00ff00', 'name': 'green', '__id': 1}]