def encode(line):
el = [ord(c) for c in line]
while len(el) is not 100:
el.append(0)
el = np.asarray(el).reshape(10,10)
return el
with open("C:\\Users\\KIIT\\Desktop\\test.txt") as f:
lines = f.readlines()[0:1]
for line in lines:
el = encode(line)
print(el)
For this code my computer is working fine with speed. But when I increase the size of the array if, the computer is stop working and I have to restart it.
the code for which it is not working:
def encode(line):
el = [ord(c) for c in line]
while len(el) is not 784:
el.append(0)
el = np.asarray(el).reshape(28,28)
return el
with open("C:\\Users\\KIIT\\Desktop\\test.txt") as f:
lines = f.readlines()[0:1]
for line in lines:
el = encode(line)
print(el)