提交 d5722767 作者: 刘伟刚

国资委网站修改22

上级 b1673733
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
...@@ -365,7 +365,10 @@ class YahooCaiwu(object): ...@@ -365,7 +365,10 @@ class YahooCaiwu(object):
currency = pq(resp1_table[0]).text() currency = pq(resp1_table[0]).text()
if 'Currency in' in currency: if 'Currency in' in currency:
result = re.findall(r'(?<=Currency in\s).*', currency) result = re.findall(r'(?<=Currency in\s).*', currency)
currency=result[0]+'(千)' currency=result[0]
if '(' in currency:
currency=currency.split('(')[0]
currency=str(currency).upper()+'(千)'
except Exception as e: except Exception as e:
currency='' currency=''
return currency return currency
......
...@@ -201,7 +201,7 @@ if __name__ == '__main__': ...@@ -201,7 +201,7 @@ if __name__ == '__main__':
['格林纳达东加勒比元','XCD'], ['格林纳达东加勒比元','XCD'],
['冈比亚达拉西','GMD'], ['冈比亚达拉西','GMD'],
['圭亚那元','GYD'], ['圭亚那元','GYD'],
['韩元','KRW'], #['韩元','KRW'],
['海地古德','HTG'], ['海地古德','HTG'],
['洪都拉斯伦皮拉','HNL'], ['洪都拉斯伦皮拉','HNL'],
['哈萨克斯坦腾格','KZT'], ['哈萨克斯坦腾格','KZT'],
...@@ -225,7 +225,7 @@ if __name__ == '__main__': ...@@ -225,7 +225,7 @@ if __name__ == '__main__':
['列斯荷兰盾','ANG'], ['列斯荷兰盾','ANG'],
['罗马尼亚新列伊','RON'], ['罗马尼亚新列伊','RON'],
['卢旺达法郎','RWF'], ['卢旺达法郎','RWF'],
['美元','USD'], #['美元','USD'],
['孟加拉塔卡','BDT'], ['孟加拉塔卡','BDT'],
['马其顿第纳尔','MKD'], ['马其顿第纳尔','MKD'],
['马拉维克瓦查','MWK'], ['马拉维克瓦查','MWK'],
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
...@@ -89,7 +89,8 @@ class Shizhi(object): ...@@ -89,7 +89,8 @@ class Shizhi(object):
doc_resp = pq(self.driver.page_source) doc_resp = pq(self.driver.page_source)
unit=doc_resp('div[id="quote-header-info"]>div:nth-child(2)>div:nth-child(1)>div:nth-child(2)>span') unit=doc_resp('div[id="quote-header-info"]>div:nth-child(2)>div:nth-child(1)>div:nth-child(2)>span')
currency = unit.text().split("Currency in ")[1] currency = unit.text().split("Currency in ")[1]
currency =currency.split("(")[0] if '(' in currency:
currency=currency.split('(')[0]
market_cap=doc_resp('td[data-test="MARKET_CAP-value"]') market_cap=doc_resp('td[data-test="MARKET_CAP-value"]')
marketcap=market_cap.text() marketcap=market_cap.text()
if marketcap and marketcap!='N/A': if marketcap and marketcap!='N/A':
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -173,7 +173,7 @@ class WanfangSpider(object): ...@@ -173,7 +173,7 @@ class WanfangSpider(object):
if __name__ == '__main__': if __name__ == '__main__':
wanfang=WanfangSpider() wanfang=WanfangSpider()
for num in range(801,1321,100): for num in range(0,1321,100):
filename=f'企业_{num}.xlsx' filename=f'企业_{num}.xlsx'
# # 创建一个工作簿 # # 创建一个工作簿
workbook = Workbook() workbook = Workbook()
......
python的镜像源
-i https://mirrors.aliyun.com/pypi/simple
-i https://pypi.douban.com/simple
-i https://pypi.tuna.tsinghua.edu.cn/simple
fdfs上传附件
1.python使用的库是 pip install py3Fdfs
参考地址 : https://www.cnblogs.com/jrri/p/11570089.html
2.obs上传文件到华为云使用的库
pip install esdk-obs-python
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论