Skip to content

Commit b04c0b0

Browse files
committed
更新获取链接查询参数值
1 parent 89061c2 commit b04c0b0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tools/url.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def get_url_param_value(url, param_key):
3434
"""
3535
result = urlparse(url)
3636
params = parse_qs(result.query, True)
37-
param_value = params.get(param_key)
37+
param_value = params.get(param_key, [])
3838
print result, '\n', params, '\n', param_value
3939
return ','.join(param_value)
4040

@@ -60,6 +60,7 @@ def test():
6060
# print urlparse(test_url).path.strip('/')
6161
test_url = 'http://localhost/test.py?a=hello&b=world'
6262
print get_url_param_value(test_url, 'a')
63+
print get_url_param_value(test_url, 'as')
6364

6465

6566
"""

0 commit comments

Comments
 (0)