-- coding:utf-8 --
from urllib import urlretrieve
import csv
urlretrieve('http://table.finance.yahoo.com/table.csv?s=000001.sz','pingan.csv')
with open('pingan.csv','rb') as rf:
reader = csv.reader(rf)
with open('pingan2.csv','wb') as wf:
writer = csv.writer(wf)
headers = reader.next()
writer.writerow(headers)
for row in reader:
if row[0] < "2016-01-01":
break
if int(row[5]) >= 50000000:
writer.writerow(row)
print "end"
读取CVS数据并筛选出2016年成交量超过50000000的记录