我定義了一個函數來創建自定義假日日曆的商業日期範圍。我想我陷入了無限循環,但不知道爲什麼?自定義Python得到BDay範圍
import datetime as dt
def get_bdate(start, end, hoildays):
list = []
while start < end:
if start.weekday() >= 5: # sunday = 6; skipping weekends
continue
if start in holidays: # holidays is a custom set of dates
continue
list.append(start)
start += dt.timedelta(days=1)
return list
哦天吶只注意到史詩失敗 –
請註明!。!正如接受,如果它幫助你:) –
@ChristopherApple:使用'list'作爲變量名clobbers [內置類型](https://docs.python.org/2/library/stdtypes.html#sequence-types -str-Unicode的列表元組的ByteArray緩衝區-x範圍)。 –