#[000001-000009] [0000001,000008,000338] [000318]
def re_stock_code(code):
stock_list = []
n_list = []
c_list = []
if code.isdigit():
c_list.append(int(code))
return c_list
else:
if code.find('-') != -1:
start_end_code = code.split('-')
start = start_end_code[0]
end = start_end_code[1]
int_start = int(start)
int_end = int(end)
for m in range(int_start, int_end):
stock_list.append(m)
return stock_list
elif code.find(',') != -1:
num_code = code.split(',')
for n in num_code:
n_list.append(int(n))
return n_list
re_date = re_stock_code('11-22')
print(re_date)
re_date = re_stock_code('111,161,112,345')
print(re_date)
re_date = re_stock_code('567')
print(re_date)
[036量化交易]股票列表过渡函数
最新推荐文章于 2024-07-22 16:31:24 发布