Python Unicode conversion (Spanish?) Please help me

Asked 1 years ago, Updated 1 years ago, 78 views

{"cc": "st","name": "S\u00e3o Tom\u00e9 and Pr\u00edncipe"}

Like the dictionary above, I got the information from a site and it came out like \u00e3 When I looked on the internet, It sounds like Spanish, but how do I convert it? {"cc": "st","name": "S\u00e3o Tom\u00e9 and Pr\u00edncipe"} This is the first time you've seen it {"cc": "st","name": "Soo Tomé and Préncipe"} How do I convert it like this?

And what do you call this form?

python utf-8 convert

2022-09-21 21:11

1 Answers

>>> l= {"cc": "st","name": "S\u00e3o Tom\u00e9 and Pr\u00edncipe"}
>>> print(l)
{'cc': 'st', 'name': 'São Tomé and Príncipe'}

No conversion required. Only the expression was like "\u00e3' but the "a"" character is present.

Unicode string.If you do code('unicode-escape'), you can see that the character is changed to u+4-digit hexadecimal number.

It's Portuguese.


2022-09-21 21:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.