Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass
Created November 22, 2020 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffersGlass/70782b986b94c272c400244bf27a2307 to your computer and use it in GitHub Desktop.
Save JeffersGlass/70782b986b94c272c400244bf27a2307 to your computer and use it in GitHub Desktop.
from itertools import permutations
filename = "perm.txt"
num = 5
data = range(num)
with open(filename, "w") as outfile:
for p in permutations(data, num):
outfile.write(str(p) + "\n")
with open(filename, "r") as infile:
for line in infile:
print(line, end="")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment