Skip to content

Commit f05aed8

Browse files
committed
no need to call json.load()
1 parent a8cea37 commit f05aed8

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

dictionary/sqlite/create_english_db_with_translation_and_ipa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
for word, details in data.items():
2525
c.execute('''
2626
INSERT INTO words (word, frequency, translation, ipa) VALUES (?, ?, ?, ?)
27-
''', (word, details['frequency'], json.dumps(details['translation']), details['ipa']))
27+
''', (word, details['frequency'], '|'.join(details['translation']), details['ipa']))
2828

2929
# Commit the changes and close the connection
3030
conn.commit()

dictionary/sqlite/query_english_db_with_translation_and_ipa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def query_words_by_prefix(prefix):
1414
for result in results:
1515
words_details.append({
1616
"word": result[0],
17-
"translation": '|'.join(json.loads(result[2])),
17+
"translation": result[2],
1818
"ipa": result[3]
1919
})
2020
return words_details
-4.37 MB
Binary file not shown.

0 commit comments

Comments
 (0)