How do I decode escaped unicode javascript code in Python?

后端 未结 2 1692
陌清茗
陌清茗 2020-12-10 19:21

I have this string:

V posledn\\u00edch m\\u011bs\\u00edc\\u00edch se bezpe\\u010dnostn\\u00ed situace v Libyi zna\\u010dn\\u011b zhor\\u0161ila, o \\u010dem\         


        
相关标签:
2条回答
  • 2020-12-10 19:40

    Decode it using the 'unicode-escape' codec. If x is your string, x.decode('unicode-escape').

    0 讨论(0)
  • 2020-12-10 19:46

    If it is Javascript code, then perhaps it's actually JSON, and you can use json.loads to decode it.

    0 讨论(0)
提交回复
热议问题