import json
with open(
r"file.txt", "r", encoding="utf-8"
) as f:
lines = f.readlines()
lines = map(lambda x: x.split(), lines)
lines = list(filter(lambda x: int(x[1]) > 30, lines))
short = list(map(lambda x: x[0], lines))[:19000]
long = list(map(lambda x: x[0], lines))[19000:]
print("short length:" + str(len(short)))
print("long length:" + str(len(long)))
# import dictionary
with open("ShortDictionary.txt", "w", encoding="utf-8") as out:
out.write("\n".join(short))