-- 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數(shù)據(jù)并篩選出2016年成交量超過50000000的記錄