将元组列表(来自 itertools)转换为文本文件中的单词列表,Python

Convert a list of tuples (from itertools) into a list of words in a text file, Python

我正在使用:

list(it.permutations(wordlist, 3))

我得到一个元组列表的结果,例如:

[('mom', 'dad', 'kid'), ('mom', 'dad', 'house'), ('mom', 'dad', 'car'), ('mom', 'dad', 'happy'), ('mom', 'dad', 'Hello'), ('mom', 'dad', 'goodbye'), ('mom', 'dad', 'covid'), ('mom', 'dad', 'influenza'), ('mom', 'dad', 'cold'), ('mom', 'dad', 'car'), ('mom', 'dad', 'escape')...]

但我真正想要的是 .txt 文件,例如:

mom dad kid\n
mom dad house\n
mom dad car\n
... etc

如何将排列直接迭代到人类可读的行中,或者如何将这个现有列表write/convert 迭代到一个文件中?谢谢(第一个问题!)

with open('path/to/output', 'w') as outfile:
    for sent in it.permutations(wordlist, 3):
        outfile.write(f"{' '.join(sent)}\n")