get ielts word

This commit is contained in:
hillerliao
2021-09-14 12:15:20 +08:00
committed by GitHub
parent b1f3f75820
commit eafe4de6b9

View File

@@ -6,10 +6,10 @@ from os import path
file_path = path.dirname(path.realpath(__file__))
def ctx():
file = path.join(file_path,'toeflwords.txt')
file = path.join(file_path,'ieltswords.txt')
with open(file, encoding='utf-8') as inf:
f = inf.readlines()
count = len(f)
wordnum = random.randrange(0, count, 1)
word = linecache.getline(file, wordnum)
return {"word": word}
return {"word": word}