Verán, mi intención sería que mi programa escribiera todas las posibles combinaciones de caracteres en txt.txt, pero no escribe nada y continúa ejecutándose.
import random
from random import choice
a='''QWERTYUIOPASDFGHJKLÑZXCVBNMqwertyuiopasdfghklñzxcvbnm1234567890@#€¡¿!?.:;'=Ç}{+-_ÁÍÓÚÉÜáíóúéü)(/&%$ºª\<>,"'''
b=(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30)
c=10
while (c==10):
d = random.choice(b)
e = ""
f = e.join([choice(a) for i in range(d)])
x = open("txt.txt", 'r')
w = [line.split(',') for line in x.readlines()]
if f in w == False:
y=open("txt.txt", "a")
y.write(f + '\n')
r = open('txt.txt', 'r')
print(r.read())
c=10 while (c==10)
¿qué propósito tiene esta línea?c
dentro del ciclo por lo quec==10
siempre va a ser cierta y como consecuencia tienes un ciclo infinito, abres el archivo repetidamente y nunca lo cierras como ya te han comentado y la sintaxisif f in w == False:
es incorrecta, eseif
siempre es falso, debe serif f not in w: