urllib2 file name

前端 未结 14 1829
感动是毒
感动是毒 2020-12-01 03:27

If I open a file using urllib2, like so:

remotefile = urllib2.urlopen(\'http://example.com/somefile.zip\')

Is there an easy way to get the

14条回答
  •  猫巷女王i
    2020-12-01 04:19

    not that I know of.

    but you can parse it easy enough like this:

    url = 'http://example.com/somefile.zip'
    print url.split('/')[-1]
    

提交回复
热议问题