Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active June 1, 2016 04:32
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 kurozumi/100f8d9d66b9f3711ace426e97037e52 to your computer and use it in GitHub Desktop.
Save kurozumi/100f8d9d66b9f3711ace426e97037e52 to your computer and use it in GitHub Desktop.
【Python】日付から曜日を取得する方法
# coding: utf-8
def get_weekday(date):
import datetime
weekday = ["月","火","水","木","金","土","日"]
d = datetime.datetime.strptime(date, "%Y/%m/%d")
return weekday[d.weekday()]
if __name__ == "__main__":
print get_weekday("2016/05/31")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment