title: urllib2 file name
body: <p>If I open a file using urllib2, like so:</p>
  
  <pre><code>remotefile = urllib2.urlopen('http://example.com/somefile.zip')
  </code></pre>
  
  <p>Is there an easy way to get the file name other then parsing the original URL?</p>
  
  <p>EDIT: changed openfile to urlopen... not sure how that happened.</p>
  
  <p>EDIT2: I ended up using:</p>
  
  <pre><code>filename = url.split('/')[-1].split('#')[0].split('?')[0]
  </code></pre>
  
  <p>Unless I'm mistaken, this should strip out all potential queries as well.</p>