title: Python - Shortest way to format a string to an url
body: <p>I'm involved in a web project. I have to choose the best ways to represent the code, so that other people can read it without problems/headaches/whatever.</p>
  
  <p>The "problem" I've tackled now is to show a nice formatted url (will be taken from a "title" string).</p>
  
  <p>So, let's suppose we have a title, fetched from the form:</p>
  
  <pre><code>title = request.form['title'] # 'Hello World, Hello Cat! Hello?'
  </code></pre>
  
  <p>then we need a function to format it for inclusion in the url (it needs to become 'hello_world_hello_cat_hello'), so for the moment I'm using this one which I think sucks for readability:</p>
  
  <pre><code>str.replace(title, ' ', '-').str.replace(title, '!', '').str.replace(title, '?', '').str.replace(string, ',' '').lower()
  </code></pre>
  
  <p>What would be a good way to compact it? Is there already a function for doing what I'm doing?</p>
  
  <p>I'd also like to know which characters/symbols I should strip from the url.</p>