0

Example:

print("\1")
print("\77")
print("\46")

output:


?
&

I have tried below codes but they didn't work.

for i in range(100):
    x = (r"\ ".strip() + str(i))
    print("{}".format(x))

for i in range(100):
    x = ("\{}".format(i))
    print(x)
    print("{}".format(x))
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
  • Please see the [formatting help](https://stackoverflow.com/help/formatting) – Tomerikoo Nov 08 '20 at 15:33
  • Does this answer your question? [How do I convert a list of ascii values to a string in python?](https://stackoverflow.com/questions/180606/how-do-i-convert-a-list-of-ascii-values-to-a-string-in-python) – Tomerikoo Nov 08 '20 at 15:34
  • What is your actual question? Many terminal control codes comprise multiple characters, annd do nothing if the second or third character etc is invalid. Probably better to read documentation for the specific terminal you are using. – tripleee Nov 08 '20 at 15:37

1 Answers1

0

This will resolve your problem

for i in range(100):
    r = "\{}".format(i)
    decoded_string = bytes(r, "utf-8").decode("unicode_escape")
    x = ("\{}".format(i))
    print(x+" = "+decoded_string)
Vishwajeet Barve
  • 547
  • 3
  • 10