I am trying find an efficient way of creating a list of dates only including the first day of the month for a given period. Something like this but better:
impor
import datetime
import calendar
import re
from datetime import date
def findDay(date):
born = datetime.datetime.strptime(date, '%Y %m %d').weekday()
return (calendar.day_name[born])
def hyp(j):
no_hyphens = re.sub('-',' ',str(j))
return no_hyphens
def send(year_start):
date = hyp(year_start)
print (date)
print(findDay(date))
epoch_year = 2019
for i in range(1,13):
year_start = date(epoch_year, i, 1)
send(year_start)