![](/img/trans.png)
[英]How is Levenshtein Distance calculated on Simplified Chinese characters?
[英]How to convert Simplified Chinese characters to html escape characters with Python?
我想從簡體中文(GB18030)中獲取html轉義字符。
我嘗試使用Python庫html.escape
但它不起作用。
例如, 寧波
到%C4%FE%B2%A8
, 江北
到%BD%AD%B1%B1
。
如何解決這個問題呢?
謝謝。
import urllib
urllib.parse.quote('寧波', encoding='GB18030') == '%C4%FE%B2%A8'#True
urllib.parse.quote('江北', encoding='GB18030') == '%BD%AD%B1%B1'#True
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.