import tushare as ts file = open("d:/stock_txt/stocklist_python.txt") path='d:/tushare/history/' filetype='.csv' while 1: line = file.readline() rs=line.replace('\n', '') if not line: break pass # name=path+rs+filetype print(name) df=ts.get_hist_data(rs,retry_count=50) df.to_csv(name)
stocklist_python.txt 里的全部的股票號碼,可以從同花順等軟件中導出