Last active
June 1, 2016 04:32
-
-
Save kurozumi/100f8d9d66b9f3711ace426e97037e52 to your computer and use it in GitHub Desktop.
【Python】日付から曜日を取得する方法
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
# 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