如何在python中解码这个字符串?
title = 'Fast & Furious 6'
获得:
Fast & Furious 6
谢谢!
最佳答案
通过这段代码,您可以从 ascii 表示法中获得字符符号。
title = 'Fast & Furious 6'
title = title[:-1]
substring=[x.strip() for x in title.split(';')]
titleFinal = ''
for ch in substring:
newstr = ch.replace("&#", "")
titleFinal+=chr(int(newstr))
print(titleFinal)
关于python - Python 中的 HTML 字符串解码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46760465/