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('output', 'w') as file:
  11. text = '\n'.join(mmap(' '.join, combinations(words, n)))
  12. file.write(text)
  13.  
  14. if __name__ == '__main__':
  15. func(2)
  16. func(3)
Runtime error #stdin #stdout #stderr 0.02s 27632KB
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'