2016-11-12 8 views

答えて

1

あなたは結果のファイルハンドラのopen、その後writeメソッドを使用することができます。

import itertools 
res = itertools.product('qwertyuiopasdfghjklzxcvbnm', repeat=3) 

with open('output.txt', 'w') as f: 
    for group in res: 
     word = ''.join(group) 
     f.write(word+'\n') 
     print(word) 
+0

ありがとうございました。 –