Skip to content
Advertisement

How to get Unicode input from user in Python?

this is the code: varUnicode = input('tEnter your Unicodent>') print('u{}'.format(varUnicode)) i want to get unicode input from user and print the character. in the above code python gives me an error.

Advertisement

Answer

u is an escape sequence recognized in string literals:

Escape sequences only recognized in string literals are:

JavaScript

Notes:

  1. Changed in version 3.3: Support for name aliases 1 has been added.
  2. Exactly four hex digits are required.
  3. Any Unicode character can be encoded this way. Exactly eight hex digits are required.

Use

JavaScript

or (maybe better)

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement