gpt4 book ai didi

python3 : How to convert a string with Unicode encoding to a string of letters

转载 作者:行者123 更新时间:2023-12-01 03:54:03 26 4
gpt4 key购买 nike

在Python3中,如何将'\\u00A9 PNG'转换为'\u00A9 PNG'(或'© PNG') ?

对于Java,有Apache Commons Lang来解码它。

我不知道在Python3中该怎么做。

最佳答案

这应该适合你。

string = '\\u00A9 PNG'
print (string.encode('utf8').decode('unicode-escape'))

输出:

© PNG

关于python3 : How to convert a string with Unicode encoding to a string of letters,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37808448/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com