-1

I want to download a file in Python shell like files get downloaded into browser. Yes, I know there are multiple ways like curl, wget, url retrieve etc. but here in all the cases, file name is not the same as original file. Like if I want to download file from this url:

http://www.siemens.com/investor/pool/en/investor_relations/financial_publications/speeches_and_presentations/110405_trading_update_q2_11.pdf

I want to download the file from this url as it get downloaded in browser, with the same name as original.

0

2 Answers 2

0

If you are using Python 2.7

urllib.urlretrieve

2
  • i know this option too, i want to have real name of file, like we get while downloading form browser.
    – jugadengg
    Commented Jan 22, 2014 at 6:32
  • use this file_name = url.split('/')[-1]
    – p2013
    Commented Nov 20, 2016 at 17:04
0

https://pypi.python.org/pypi/wget

There is a simple option. Not familiar with Python as well as other languages.

1
  • hi i know this option ,i have mentioned my requirement. here if i use wget, it does not give me real name of file ,but it does gives me name extracted from url .like for this 'ir.paalp.com/…' it will give me External.asp as file name, but that is not real name actually .
    – jugadengg
    Commented Jan 22, 2014 at 6:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.