from selenium import webdriver #导入模块,selenium导入浏览器驱动,用get方法打开浏览器
import time
import re
import csv #存储数据
from lxml import etree #数据的解析
import pandas as pd
import numpy as np
option = webdriver.ChromeOptions() #网址获取
option.add_argument('headless') #无界面启动,即设置浏览器静默
driver = webdriver.Chrome(options=option)
driver.get('http://data.eastmoney.com/zjlx/000040.html')
table=driver.find_element(By.ID,'table_ls')
# data_heads1=table.find_elements(By.TAG_NAME,'th')[:8]
# data_heads2=table.find_elements(By.TAG_NAME,'th')[8:]
data_bodies = table.find_element(By.TAG_NAME,'tbody').find_elements(By.TAG_NAME,'tr')
datas=[]
for data_body in data_bodies:
data3=data_body.text.split()
datas.append(data3)
datas
name=['日期','收盘价','涨跌幅','主力净流入净额','主力净流入净占比','超大单净流入净额','超大单净流入净占比',
'大单净流入净额','大单净流入净占比',&#