Home > other >  Consult requests. The get () download the XLS file is empty
Consult requests. The get () download the XLS file is empty

Time:09-17

Python is a small white one, want to download straight flush financial statements, the stock code 300033 balance sheet url="http://basic.10jqka.com.cn/api/stock/export.php? Export=debt& Type=year& Code=300033 ", according to the code below is only the result of the new empty file, download content not come down, for advice?


The import requests

Code=[]

File_codes=open (r 'folder D: \ \ 20200506 \ stockcode TXT')
Codes=file_readlines. Read (). Splitlines ()

Url="http://basic.10jqka.com.cn/api/stock/export.php? Export=benefit& Type=year& Code='
For code in codes:
Finance_resport=requests. Get (url + STR (code)). The content
With the open (" D: \ \ folder \ \ 20200524 flush \ \ LRB \ \ {} CSV ". The format (code), "wb") as f:
F.w rite (finance_resport)
  • Related