这是一个漫长的过程,但是至少它可以工作,并且不需要标准模块以外的任何东西。
import datetimenow = datetime.datetime.now()holidays = {datetime.date(now.year, 8, 14)} # you can add more herebusinessdays = 0for i in range(1, 32): try: thisdate = datetime.date(now.year, now.month, i) except(ValueError): break if thisdate.weekday() < 5 and thisdate not in holidays: # Monday == 0, Sunday == 6 businessdays += 1print businessdays
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)