Arkadaşlar aşağıdaki kodun outputunu nasıl kaydedebilirim ? ( printten gelen çıktıyı )
import string
from itertools import permutations
numaralar = list(string.digits)
hane = int(input("Minimum değeri giriniz: "))
max = int(input("Max değeri giriniz : "))
n = 0
def Sifreolusturma(hane):
for password in permutations(numaralar, hane):
print("".join(password))
n += 1
while hane <= max:
Sifreolusturma(hane)
hane += 1
Şöyle:
import string
from itertools import permutations
numaralar = list(string.digits)
hane = int(input("Minimum değeri giriniz: "))
_max = int(input("Max değeri giriniz : "))
def Sifreolusturma(hane, dosya):
for password in permutations(numaralar, hane):
dosya.write(f"{''.join(password)}\n")
cikti = open("output.txt", "w")
while hane <= _max:
Sifreolusturma(hane, cikti)
hane += 1