Skip to content

Commit

Permalink
no need to call json.load()
Browse files Browse the repository at this point in the history
  • Loading branch information
dongyuwei committed Apr 7, 2024
1 parent a8cea37 commit f05aed8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
for word, details in data.items():
c.execute('''
INSERT INTO words (word, frequency, translation, ipa) VALUES (?, ?, ?, ?)
''', (word, details['frequency'], json.dumps(details['translation']), details['ipa']))
''', (word, details['frequency'], '|'.join(details['translation']), details['ipa']))

# Commit the changes and close the connection
conn.commit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def query_words_by_prefix(prefix):
for result in results:
words_details.append({
"word": result[0],
"translation": '|'.join(json.loads(result[2])),
"translation": result[2],
"ipa": result[3]
})
return words_details
Expand Down
Binary file not shown.

0 comments on commit f05aed8

Please sign in to comment.