I am having large\huge number of Codes ( number of Codes = 9898654986. ) even sometime it will be (10, 20, 40.... even 200digits) in multiple files. I want to make all possible combination of that codes, combination should be printed on multiple files. but I want all possible combination, for example if codes = ab1, aa2, dc3, xx4. so combination should be be like.. ('ab1', 'ab1'), ('ab1', 'aa2'), ('ab1', 'dc3'), ('ab1', 'xx4'), ('aa2', 'ab1'), ('aa2', 'aa2'), ('aa2', 'dc3'), ('aa2', 'xx4'), ('dc3', 'ab1'), ('dc3', 'aa2'), ('dc3', 'dc3'), ('dc3', 'xx4'), ('xx4', 'ab1'), ('ab1', 'aa2'), ('ab1', 'dc3'), ('xx4', 'xx4'). for at least less than 1 millions codes with single file I doing this way.
import os, import pandas as pd, import itertools
os.chdir('C:/Users/Rashid/Desktop/Try')
df = pd.read_excel("code1.xlsx", header=None, index_col=False, dtype=str)
df.columns = ['A']
i = 0
lines = []
for item in itertools.product(df['A'], repeat=4):
lines.append(item)
if len(lines) > 50000:
with open(f'4ta.{i}.txt', 'a') as f:
f.write(''.join(str(lines)))
lines = []
i += 1