Created
August 30, 2023 15:05
-
-
Save utkuboduroglu/2fec1e309e8a00daedf00606402940fc to your computer and use it in GitHub Desktop.
A quick script for generating mail body/subject to be sent to landlords :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
def main(): | |
# we hardcode the filename for quick use | |
with open("./mail_boilerplate.txt", "r") as paste_fp: | |
mail_body = paste_fp.read() | |
# by convention, we will read input sequentially as follows: | |
# contact e-mail, contact name, shortened location, full location | |
if len(sys.argv) < 4: | |
print("Please pass the necessary arguments!", file=sys.stderr) | |
sys.exit(1) | |
# let's split cmdline args into their respective fields | |
data_dict = { | |
"contact_email": sys.argv[1], | |
"contact_name": sys.argv[2], | |
"short_location": sys.argv[3].split(' ')[0], | |
"full_location": sys.argv[3] | |
} | |
print(mail_body.format(**data_dict)) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment