I just need to print a list of int to ASCII.
a=list(str(12345))
for q in a:
print(chr(q))
an integer is required (got type str)
why I'm getting that error?
You are passing a string value into the chr() function. This should work:
a=list(str(12345))
for q in a:
print(chr(int(q)))
#The above code will work but this will print out characters, as 1-5
# in the ASCII table are not visible characters.
a = [65,66,67,68,69]
for q in a:
print(chr(q))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With