有没有一种方法在python中url编码列表没有变量名称?例如 q = ['with space1','with space2'] into qescaped = ['with%20space1','with%20space2']
您可以将urllib.quote与地图一起使用:
import urllib q = ['with space1', 'with space2'] qescaped = map(urllib.quote, q)