Skip to content

Instantly share code, notes, and snippets.

@hemache
Created May 29, 2013 21:40
Show Gist options
  • Save hemache/5674043 to your computer and use it in GitHub Desktop.
Save hemache/5674043 to your computer and use it in GitHub Desktop.
import itertools
lines = list()
lines.append(open('1.txt').readlines())
lines.append(open('2.txt').readlines())
combinations = list(itertools.product(*lines))
with open('result.txt', 'w') as result:
for combination in combinations:
line = ''.join([s.strip() for s in combination])
line += '\r\n'
result.write(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment