title: How to formally insert URL space (%20) using Python?
body: <p>When a mutli-word search term is entered in ebay, the resultant URL looks something like (for example "demarini cf5 cf12"):</p>
  
  <pre><code>http://www.ebay.com/sch/i.html?_from=R40&amp;amp;_sacat=0&amp;amp;_nkw=demarini%20cf5%20cfc12
  </code></pre>
  
  <p>I wish to construct this URL in Python so it can be accessed directly. So it's case of concatenating the base URL:</p>
  
  <pre><code>http://www.ebay.com/sch/i.html?_from=R40&amp;amp;_sacat=0&amp;amp;_nkw=
  </code></pre>
  
  <p>... with the search term. Right now. I am adding the <code>%20</code> for the spaces explicately thus:</p>
  
  <pre><code>baseUrl = 'http://www.ebay.com/sch/i.html?_from=R40&amp;amp;_sacat=0&amp;amp;_nkw='
  searchTerm = 'demarini cf5 cf12'
  searchTerm = ('%20').join(searchTerm.split(' '))
  finalUrl = baseUrl + searchTerm
  </code></pre>
  
  <p>What is a more formal way of doing this in Python? I believe the name for this sort of task is URL encoding?</p>