$ python3 -v env this-folder
$ src this-folder/bin/activate
$ pip install python-lambda-local
$ python-lambda-local -f lambda_handler -t 5 handler.py event.json
Created
July 18, 2017 07:43
-
-
Save masahitojp/1ad8e1d0d9e8f5cfa2b355460422eb47 to your computer and use it in GitHub Desktop.
create test
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
{ | |
"answer": 42 | |
} |
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
from datetime import datetime | |
def lambda_handler(event, context): | |
input_date = datetime.today() | |
yukari = '田村ゆかり' | |
birth = datetime(1976, 2, 27) | |
month_17 = ((input_date.year - birth.year) - 17) * 12 + (input_date.month - birth.month) | |
if input_date.day < birth.day: month_17 -= 1 | |
print(f"{input_date.strftime('%Y年%m月%d日')}の{yukari}は17歳と{month_17}ヶ月") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment