Skip to content

Instantly share code, notes, and snippets.

@masahitojp
Created July 18, 2017 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masahitojp/1ad8e1d0d9e8f5cfa2b355460422eb47 to your computer and use it in GitHub Desktop.
Save masahitojp/1ad8e1d0d9e8f5cfa2b355460422eb47 to your computer and use it in GitHub Desktop.
create test
$ 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
{
"answer": 42
}
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