I tried to automatically generate a character string to be input to Mr. Adjustment with Python

Customary fucking code

Adjustment's input is quite troublesome

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. image.png 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

I should have written it in JS from the beginning and made it on the Web

Don't say any more

Recommended Posts

I tried to automatically generate a character string to be input to Mr. Adjustment with Python
I tried to automatically generate a password with Python3
I tried to generate a random character string
[Outlook] I tried to automatically create a daily report email with Python
I tried to draw a route map with Python
I want to split a character string with hiragana
I tried to automatically create a report with Markov chain
[Python] I tried to automatically create a daily report of YWT with Outlook mail
I tried to automatically generate OGP of a blog made with Hugo with tcardgen made by Go
[5th] I tried to make a certain authenticator-like tool with python
[2nd] I tried to make a certain authenticator-like tool with python
[Introduction to Python] How to split a character string with the split function
[3rd] I tried to make a certain authenticator-like tool with python
[Python] A memo that I tried to get started with asyncio
Try to extract a character string from an image with Python3
I tried to create a list of prime numbers with python
I tried to make a periodical process with Selenium and Python
I tried to make a 2channel post notification application with Python
I tried to make a todo application using bottle with python
[4th] I tried to make a certain authenticator-like tool with python
[1st] I tried to make a certain authenticator-like tool with python
I tried to automatically collect images of Kanna Hashimoto with Python! !!
I made a character counter with Python
Python3 standard input I tried to summarize
I tried a functional language with Python
I tried to communicate with a remote server by Socket communication with Python.
I made a tool to automatically browse multiple sites with Selenium (Python)
I tried to create a program to convert hexadecimal numbers to decimal numbers with python
I tried to make a traffic light-like with Raspberry Pi 4 (Python edition)
I tried to discriminate a 6-digit number with a number discrimination application made with python
[Introduction to Python] How to write a character string with the format function
I tried to build a Mac Python development environment with pythonz + direnv
I want to make a game with Python
I tried to get CloudWatch data with Python
I tried to output LLVM IR with Python
Try to automatically generate Python documents with Sphinx
I tried to automate sushi making with python
I want to write to a file with Python
I tried to make a periodical process with CentOS7, Selenium, Python and Chrome
I tried to make a simple mail sending application with tkinter of Python
[Patent analysis] I tried to make a patent map with Python without spending money
When I tried to create a virtual environment with Python, it didn't work
[ES Lab] I tried to develop a WEB application with Python and Flask ②
I tried to automatically generate a port management table from Config of L2SW
I tried to easily create a fully automatic attendance system with Selenium + Python
[Python] I tried to get the type name as a string from the type function
I tried to implement what seems to be a Windows snipping tool in Python
I tried to automatically send the literature of the new coronavirus to LINE with Python
How to convert / restore a string with [] in python
I want to embed a variable in a Python string
I tried to create a table only with Django
I tried to read and save automatically with VOICEROID2 2
I want to generate a UUID quickly (memorandum) ~ Python ~
I tried to implement Minesweeper on terminal with python
I tried to get started with blender python script_Part 01
I tried to touch the CSV file with Python
[Python] How to expand variables in a character string
I tried to solve the soma cube with python
I tried to implement a pseudo pachislot in Python
I tried to automatically read and save with VOICEROID2
I tried to get started with blender python script_Part 02