[英]Python encode string to html
如何將一個字符串和特殊字符編碼為html?
例如,如果我有“ test @ test”,我將如何對其進行編碼,使其變為“ test%40test”
有沒有一種簡便的方法可以代替使用replace手動列出要替換的每個列表?
嘗試使用urlencode
函數。 這里的文檔。
https://docs.python.org/2/library/urllib.html#urllib.urlencode
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.