When I'm trying to print all ASCII chars in Python only 127 are getting printed and I'm getting an error with output after 127. I'm unable to understand what does that error mean.
t = list(range(0, 256))
for x in t:
print(str(x) + ". " + chr(x))
Traceback (most recent call last):
File "D:\Study\Pedia\Python Book\6. Functions\2. Built-in functions\ord_chr.py", line 6, in <module>
print(str(x) + ". " + str(chr(x)))
File "C:\Python33\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\x80' in position 5: character maps to <undefined>
Note: I can't show you the complete output because I can't copy complete raw output from by sublime output console. Don't know the real reason why it can't get copied.
ASCII includes definitions for 128 characters (0
to 127
).
\x80
(128) is not included there.