title: How to extract a filename from a URL and append a word to it?
body: <p>I have the following URL:</p>
  <pre><code>url = http://photographs.500px.com/kyle/09-09-201315-47-571378756077.jpg
  </code></pre>
  <p>I would like to extract the file name in this URL: <code>09-09-201315-47-571378756077.jpg</code></p>
  <p>Once I get this file name, I'm going to save it with this name to the Desktop.</p>
  <pre><code>filename = **extracted file name from the url**     
  download_photo = urllib.urlretrieve(url, &quot;/home/ubuntu/Desktop/%s.jpg&quot; % (filename))
  </code></pre>
  <p>After this, I'm going to resize the photo, once that is done, I've going to save the resized version and append the word &quot;_small&quot; to the end of the filename.</p>
  <pre><code>downloadedphoto = Image.open(&quot;/home/ubuntu/Desktop/%s.jpg&quot; % (filename))               
  resize_downloadedphoto = downloadedphoto.resize.((300, 300), Image.ANTIALIAS)
  resize_downloadedphoto.save(&quot;/home/ubuntu/Desktop/%s.jpg&quot; % (filename + _small))
  </code></pre>
  <p>From this, what I am trying to achieve is to get two files, the original photo with the original name, then the resized photo with the modified name. Like so:</p>
  <pre><code>09-09-201315-47-571378756077.jpg
  </code></pre>
  <p>rename to:</p>
  <pre><code>09-09-201315-47-571378756077_small.jpg
  </code></pre>
  <p>How can I go about doing this?</p>