# coding:utf-8
try:
    from urllib2 import urlparse
except:
    from urllib import parse as urlparse

d = urlparse.urlparse("http://www.test.com/a/b/c?name=李明&age=18&sex=man")
path = d.path
q = urlparse.parse_qs(d.query)
print(path) #'/a/b/c'
print(q) #{'name': ['李明'], 'age': ['18'], 'sex': ['man']}

  

 

 posted on 2023-03-17 18:00  boye169  阅读(72)  评论(0)    收藏  举报