toki_pona/sorted.py
2023-10-08 18:27:27 +02:00

20 lines
562 B
Python

from dictionary import toki_pona_en
def main():
all_words = dict()
for lesson, word_dict in toki_pona_en.items():
for word, meanings in word_dict.items():
lesson_n = lesson.split('_')[1]
all_words[word] = '{}_{}'.format(lesson_n, meanings.split(',')[0].strip())
for idx, word in enumerate(sorted(all_words.keys())):
if idx % 2 == 0:
print()
lesson, meaning = all_words[word].split('_')
print('{} {:<16}: {}'.format(lesson, word, meaning))
if __name__ == "__main__":
main()