title: Best way to get query string from a URL in python?
body: <p>I need to get the query string from this URL <a href="https://stackoverflow.com/questions/ask?next=1&amp;value=3">https://stackoverflow.com/questions/ask?next=1&amp;value=3</a> and I don't want to use <a href="https://docs.djangoproject.com/en/2.1/ref/request-response/#django.http.HttpRequest.META" rel="noreferrer">request.META</a>. I have figured out that there are two more ways to get the query string:</p>
  
  <ol>
  <li><p><strong>Using urlparse</strong>
  urlparse.urlparse(url).query</p></li>
  <li><p><strong>Using url encode</strong>
  Use urlencode and pass the request.GET params dictionary into it to get the string representation.</p></li>
  </ol>
  
  <p>So which way is better? My colleagues prefer urlencode but have not provided a satisfying explanation. They claim that urlparse calls urlencode internally which is something I'm not sure about since urlencode lives in the urllib module.</p>