fork download
  1. # IdeaGen v0.1
  2. # License: Public Domain
  3.  
  4. import itertools
  5.  
  6. def func(n):
  7. with open("wordslist.txt") as file:
  8. words = file.read().splitlines()
  9.  
  10. with open('ideaslist.txt', 'a') as file:
  11. text = '\n'.join(map(' '.join, itertools.combinations(words, n)))
  12. file.write(text)
  13. file.write('\n')
  14.  
  15. func(2)
  16. func(3)
  17.  
  18. with open('ideaslist.txt', 'a') as file:
  19. file.write('\n')
Runtime error #stdin #stdout #stderr 0.02s 27712KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 15, in <module>
  File "./prog.py", line 7, in func
FileNotFoundError: [Errno 2] No such file or directory: 'wordslist.txt'