File tree Expand file tree Collapse file tree 3 files changed +5
-11
lines changed
Expand file tree Collapse file tree 3 files changed +5
-11
lines changed Original file line number Diff line number Diff line change 55with TinyDB ("countries.json" , indent = 4 ) as countries_db :
66 countries_table = countries_db .table (name = "countries" )
77
8- countries_table .insert (
9- {"location" : "Vatican City" , "population" : 501 }
10- )
8+ countries_table .insert ({"location" : "Vatican City" , "population" : 501 })
119
1210 countries_table .insert_multiple (
1311 [
2119
2220 for row in reader :
2321 row ["population" ] = int (row ["population" ])
24- countries_table .insert (row )
22+ countries_table .insert (row )
Original file line number Diff line number Diff line change 77countries_db = TinyDB ("ten_countries.json" )
88countries_table = countries_db .table (name = "countries" )
99query = Query ()
10- query_def = (query .population > 220_000_000 ) & (
11- query .population < 250_000_000
12- )
10+ query_def = (query .population > 220_000_000 ) & (query .population < 250_000_000 )
1311pprint (countries_table .search (query_def ))
1412pprint (countries_table .search (query_def ))
1513pprint (countries_table .search (query ["% of world" ] >= 17 ))
1614pprint (countries_table .get (doc_ids = [9 , 10 ]))
17- countries_db .close ()
15+ countries_db .close ()
Original file line number Diff line number Diff line change 22
33with TinyDB ("ten_countries.json" ) as countries_db :
44 countries_table = countries_db .table (name = "countries" )
5- countries_table .update (
6- {"source" : "Official estimate" }, doc_ids = [7 , 9 ]
7- )
5+ countries_table .update ({"source" : "Official estimate" }, doc_ids = [7 , 9 ])
You can’t perform that action at this time.
0 commit comments