我需要在python中弄清楚如何(在pesudo中)
x = month-begin
y = month-end
for range in (x through y)
print(dates of weekdays - Monday trough Friday)
答案 0 :(得分:1)
使用date.weekday()。按照您的伪代码示例:
for day in range (x through y)
if day.weekday() in range(0,5):
print(day)
答案 1 :(得分:1)
使用datetime模块:
import datetime
current=datetime.datetime(2018,8,14,14,00)
end=datetime.datetime(2018,12,1,14,00)
while current<end:
current+=datetime.timedelta(days=1)
if current.weekday()<5:
print(current.strftime("%-m/%-d"))