Created
October 8, 2016 07:08
-
-
Save serinuntius/d9ba0790bb6c3d2e3c082a8b7e1e3403 to your computer and use it in GitHub Desktop.
時価総額、発行済株式数を取得するやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
import lxml.html | |
import time | |
driver = webdriver.PhantomJS() | |
driver.get("http://hesonogoma.com/stocks/japan-all-stock-data.html") | |
data = driver.page_source | |
root = lxml.html.fromstring(data) | |
driver.find_element_by_xpath('//*[@id="japan-all-stock-data_length"]/label/select/option[7]').click() | |
time.sleep(1) | |
for zika, num in zip(root.xpath('//*[@id="japan-all-stock-data"]/tbody/tr[position() >= 3]/td[5]'), | |
root.xpath('//*[@id="japan-all-stock-data"]/tbody/tr[position() >= 3]/td[6]')): | |
# print("hoge") | |
print(zika.text, num.text) | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment