Python入門–日付(datetime)の基本的な使い方

コード下記:

import datetime, calendar

lastFriday = datetime.date.today( )
oneday = datetime.timedelta(days=1)
lastFriday -= oneday
while lastFriday.weekday( ) != calendar.FRIDAY:
lastFriday -= oneday
print lastFriday.strftime('%A, %d-%b-%Y’)

Python

Posted by arkgame