|
|
|
|
|
by toiletduck
1371 days ago
|
|
I know it's not the point the author is trying to make, but I couldn't help get the feeling this example isn't good enough to carry the point. from stdlib: from urllib.parse import urlparse, parse_qsl
url = 'https://www.example.com/some_pathsome_key=some_value&foo=bar'
parsed_url = urlparse(url)
values = [v for _, v in parse_qsl(parsed_url.query)]
print(values)
which I guess you could oneliner back to this.. [v for _, v in parse_qsl(urlparse(url).query]
|
|