Chakirantsi
Femtopat
- Katılım
- 20 Şubat 2023
- Mesajlar
- 11
Daha fazla
- Cinsiyet
- Erkek
Dostlar Python'da bir proje üstünde çalışıyorum. Aşağı kısıma ekleyeceğim üzere iki kısım var birinci kısım mail ikinci kısım şifre oluşturuyor tamamen random komutunu kullanarak ben ise burada oluşturulan mail ve şifreyi txt dosyasına otomatik olarak her oluşturduğunda kayıt etmesini istiyorum fakat başaramadım. Birkaç kod buldum fakat random üretilen maili ve şifreyi yazmak yerine kendisi üretilen dışında random mail ve şifre yazıyor. Desteklerinizi bekliyorum, kodlar şu şekilde;
def generate_random_email():
random_string = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(10))
random_domain = ''.join(random.choice(string.ascii_letters) for _ in range(5))
random_tld = random.choice(['com'])
random_email = random_string + '@' + 'gmail' + '.' + random_tld
return random_email
def generate_random_password():
random_password = ''.join(random.choice(string.ascii_letters + string.digits + string.punctuation) for _ in range(12))
while (not any(c.isupper() for c in random_password)) or (not any(c.islower() for c in random_password)) or (not any(c.isdigit() for c in random_password)) or (not any(c in string.punctuation for c in random_password)):
random_password = ''.join(random.choice(string.ascii_letters + string.digits + string.punctuation) for _ in range(8))
return random_password
Bu kodlarda random şifre ve mail oluşturuluyor oluşturulan mail ve şifreyi kayıt etmek istiyorum.
def generate_random_email():
random_string = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(10))
random_domain = ''.join(random.choice(string.ascii_letters) for _ in range(5))
random_tld = random.choice(['com'])
random_email = random_string + '@' + 'gmail' + '.' + random_tld
return random_email
def generate_random_password():
random_password = ''.join(random.choice(string.ascii_letters + string.digits + string.punctuation) for _ in range(12))
while (not any(c.isupper() for c in random_password)) or (not any(c.islower() for c in random_password)) or (not any(c.isdigit() for c in random_password)) or (not any(c in string.punctuation for c in random_password)):
random_password = ''.join(random.choice(string.ascii_letters + string.digits + string.punctuation) for _ in range(8))
return random_password
Bu kodlarda random şifre ve mail oluşturuluyor oluşturulan mail ve şifreyi kayıt etmek istiyorum.