Customary fucking code
As you know Adjustment is an online tool that is convenient for schedule adjustment by multiple people, but it is quite troublesome to handwrite all the candidate schedules. For example, if the candidate date is "10 days from May 20th to 29th" and there are 3 candidates each day, it is quite difficult to manually enter them, so we automated it.
Python The content is as commented
chousei.py
# Python3
import datetime
import locale
date = datetime.datetime(2020, 5, 18) #Candidate day first day(Year,Month,Day)
days = 10 #Candidate days(First day-the last day)
arg=["9:00~12:00", "12:00~15:00", "15:00~18:00", "18:00~"]#Character string such as time zone
locale.setlocale(locale.LC_TIME)
def main(date,days,arg):
out=[]
arg_len=len(arg)
locale.setlocale(locale.LC_TIME)
while(days>0): #Loop by changing the date
counter=0
while(counter<arg_len): #Loop to add candidate time zones on the same day
out.append( str(date.year) +"Year"+ str(date.month) +"Month"+ str(date.day) +"Day"+ "(" + str(date.strftime('%a')) + ")" + str(arg[counter]) )
counter+=1
date+=datetime.timedelta(days=1) #Increase the date you enter by 1
days -= 1 #Reduce the number of candidate days remaining by 1
return out #Returns an array from a function
out=main(date,days,arg)
for l in out: #Print array elements line by line
print(l)
We plan to add this to Slackbot soon
Don't say any more
Recommended Posts