Python, opposite function urllib.urlencode

后端 未结 3 929
既然无缘
既然无缘 2020-11-30 21:57

How can I convert data after processing urllib.urlencode to dict? urllib.urldecode does not exist.

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-30 22:48

    urllib.unquote_plus() does what you want. It replaces %xx escapes by their single-character equivalent and replaces plus signs with spaces.

    Example:

    unquote_plus('/%7Ecandidates/?name=john+connolly') 
    

    yields

    '/~candidates/?name=john connolly'.
    

提交回复
热议问题