-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- merge all v2 json - read json
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os, sys | ||
import json | ||
|
||
# dir = "data" | ||
dir = "v2" | ||
|
||
out = open("all_cedict.json", "w", encoding="utf-8") | ||
|
||
out.write("{") | ||
print("{") | ||
for fn in os.listdir(dir): | ||
with open(dir + '/' + fn, 'r', encoding="utf-8") as f: | ||
read_data = f.read() | ||
json_data = json.loads(read_data) | ||
sim = json_data["simplified"] | ||
data = '"' + sim + '":' + read_data | ||
out.write(data) | ||
print(data) | ||
out.write(",\n") | ||
print(",") | ||
out.write("}") | ||
print("}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import json | ||
with open("all_cedict.json", "r", encoding="utf-8") as f: | ||
data = json.load(f) | ||
|
||
print(data["比如"]) |