# 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']}
标签:parse,Python,sex,urlparse,url,import,path,解析 From: https://www.cnblogs.com/boye169/p/17227746.html