$BIG_CORP rides the snake - my first Python script
In between support tasks at $BIG_CORP I’ve been slowly reading through O’Reilly’s Learning Python and trying a few things out with the command-line interpreter.
The first script I’ve written that actually does something useful is
countdown to 5pm
import datetime now = datetime.datetime.now() home = datetime.datetime(now.year, now.month, now.day, 17, 0, 0, 0) total_secs = (home - now).seconds hours = total_secs / (60 * 60) minutes = (total_secs - (hours * 60 * 60)) / 60 print hours, " hours and “, minutes, " minutes until 5pm”
Very simple I know but I just had to share it ;)