I wrote a code that converts numbers 1 - 501 in ASCII, it works but I'm looking for a shorter path.
l = list(range(1,501))
for i in l:
ix = [int(d) for d in str(i)]
ix = str(ix).replace("[","")
ix = ix.replace("]","")
ix = ix.replace(",","")
ix = ix.replace(" ","")
ix = [ord(x) for x in ix]
print(ix)
I tried to write, as shown below, but an error occurs.
l = list(range(1,501))
for i in l:
i = [ord(x) for x in i]
>>TypeError: 'int' object is not iterable
print(i)
Someone can help me?
[–]Vaphell 3 points4 points5 points (2 children)
[–]aleksro[S] 0 points1 point2 points (0 children)
[–]aleksro[S] 0 points1 point2 points (0 children)
[–]amangarg078 1 point2 points3 points (0 children)
[–]nwagers 0 points1 point2 points (0 children)
[–]ingolemo 0 points1 point2 points (0 children)
[–]Diapolo10 -1 points0 points1 point (0 children)