fork download
# IdeaGen v0.1
# License: Public Domain
import time
t1 = time.time()
import itertools

def func(n):
    l = []
    with open('wordslist.txt') as file:
        l = file.read().splitlines()

    l2 = itertools.combinations(l, n)
    l2 = list(l2)
    l3 = str(l2)
    l3 = l3.replace('[','')
    l3 = l3.replace(']','')
    l3 = l3.replace("'",'')
    l3 = l3.replace(",",'')
    l3 = l3.replace("(",'')
    l3 = l3.replace(') ', '\n')
    l3 = l3.replace(")",'')
    print(l3)

    with open('ideaslist.txt', 'a') as file:
        file.write(l3)
        file.write('\n')

func(2)
func(3)

with open('ideaslist.txt', 'a') as file:
    file.write('\n')
print(time.time() - t1)
Runtime error #stdin #stdout #stderr 0.02s 28360KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 28, in <module>
  File "./prog.py", line 9, in func
FileNotFoundError: [Errno 2] No such file or directory: 'wordslist.txt'