Comment

Comment by toiletduck

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]
parent toiletduck 4 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton