2012年1月18日星期三

python url encone

/ 不會被編碼的問題:

>>> import urllib
>>> urllib.quote('/test')
'/test'
>>> urllib.quote('/test', '')
'%2Ftest'
>>> urllib.quote('\n', '')
'%0A'
>>> urllib.quote('\r', '')
'%0D'

ref:
http://stackoverflow.com/questions/1695183/how-to-percent-encode-url-parameters-in-python

0 意見: