With combinations with replacement - 101270 entries: (runs instantly excluding file IO)
import itertools
with open('available.txt', 'w') as f:
lol = []
a = [i for i in '1234567890._abcdefghijklmnopqrstuvwxyz']
lol = list(itertools.combinations_with_replacement(a, 4))
for comb in lol:
f.write(comb)
With combinations without replacement - 73815 entries: (runs instantly excluding file IO)
import itertools
with open('available.txt', 'w') as f:
lol = []
a = [i for i in '1234567890._abcdefghijklmnopqrstuvwxyz']
lol = list(itertools.combinations(a, 4))
for comb in lol:
f.write(comb)
With permutations without replacement - 1771560 entries: (runs instantly excluding file IO)
import itertools
with open('available.txt', 'w') as f:
lol = []
a = [i for i in '1234567890._abcdefghijklmnopqrstuvwxyz']
lol = list(itertools.permutations(a, 4))
for comb in lol:
f.write(comb)
With permutations with replacement - 2085136 entries: (runs in about 2 seconds excluding file IO)
lol = []
for a in '1234567890._abcdefghijklmnopqrstuvwxyz':
for b in '1234567890._abcdefghijklmnopqrstuvwxyz':
for c in '1234567890._abcdefghijklmnopqrstuvwxyz':
for d in '1234567890._abcdefghijklmnopqrstuvwxyz':
lol.append(a+b+c+d)
with open('my_dump.txt', 'w') as f:
f.write(repr(lol))
Most likely you wanted permutations with replacement, as you specified 38^4
total possibilities. (Use the term permutations next time!) Slicing off the first 100 entries in this list:
>>> lol[:100]
['1111', '1112', '1113', '1114', '1115', '1116', '1117', '1118', '1119', '1110', '111.', '111_', '111a', '111b', '111c', '111d', '111e', '111f', '111g', '111h', '111i', '111j', '111k', '111l', '111m', '111n', '111o', '111p', '111q', '111r', '111s', '111t', '111u', '111v', '111w', '111x', '111y', '111z', '1121', '1122', '1123', '1124', '1125', '1126', '1127', '1128', '1129', '1120', '112.', '112_', '112a', '112b', '112c', '112d', '112e', '112f', '112g', '112h', '112i', '112j', '112k', '112l', '112m', '112n', '112o', '112p', '112q', '112r', '112s', '112t', '112u', '112v', '112w', '112x', '112y', '112z', '1131', '1132', '1133', '1134', '1135', '1136', '1137', '1138', '1139', '1130', '113.', '113_', '113a', '113b', '113c', '113d', '113e', '113f', '113g', '113h', '113i', '113j', '113k', '113l']