当循环中出现异常时,如何跳过循环中的异常继续执行,下面是一种可行的方法:
代码语言:text复制import pandas as pd
dates=range(20161010,20161114)
pieces=[]
for date in dates:
try:
data=pd.read_csv('A_stock/overview-push-%d/stock overview.csv' �te, encoding='gbk')
pieces.append(data)
except OSError:
pass
continue
data=pd.concat(pieces)
data.shape
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
个人分类: python量化分析