and55code
and55code

Reputation: 3

how to replace Unicode Hex Character Code

my_string = "smart watch Xiaomi / Smart watches for women, men, children"

How can I get the character "/".

i do this: my_string.replace("/", "/") But I don't want to use this method.

Upvotes: 0

Views: 421

Answers (1)

JosefZ
JosefZ

Reputation: 30123

html — HyperText Markup Language support

html.unescape(s)

Convert all named and numeric character references (e.g. >, >, >) in the string s to the corresponding Unicode characters. This function uses the rules defined by the HTML 5 standard for both valid and invalid character references, and the list of HTML 5 named character references.

New in version 3.4.

my_string = "smart watch Xiaomi / Smart watches for women, men, children"
import html
html.unescape(my_string)
# 'smart watch Xiaomi / Smart watches for women, men, children'

Upvotes: 1

Related Questions