title: removing unwanted characters after image extension in a string
body: <p>I got a few img urls which I need to download. I see some urls have unwanted characters after the image extension, which I need to remove/delete before the download. </p>
  
  <p>For example the following url contains <code>?6ce6a3=</code> after the jpeg extension, which needs to be removed; the image extensions could be <code>png</code>, <code>jpg</code>, <code>jpeg</code> or <code>gif</code>. I need your input how to do it. Do I need to use a regex or a function already available in python. I know various <code>strip()</code> methods are available, but I am not sure which one works best. A little guidance will be helpful. I have found a similar question here: <a href="https://stackoverflow.com/questions/36192550/removing-unwanted-characters-after-extension">Removing unwanted characters after extension</a> but you got to know your extension beforehand, however.   </p>
  
  <pre><code>url = 'http://4.kicksonfire.net/wp-content/uploads/2014/10/12.jpeg?6ce6a3='
  print os.path.basename(url) # result 12.jpeg?6ce6a3=
  print os.path.splitext(url)[1] # .jpeg?6ce6a3=
  </code></pre>