0

#如果它出现在给定的 url 中,我必须只对字符进行百分比编码。我知道我们可以使用urllib.quote. 它需要一个safe关键字来设置特定字符以对 URL 安全。我正在寻找类似的东西:

a = 'http://localhost:8001/3.0/lists/list_1.localhost.org/roster/owner#iammdkdkf'
b = urllib.quote(a,unsafe='#')

问候。

4

1 回答 1

2

怎么样a.replace('#','%23')

于 2015-03-08T16:45:41.323 回答