Mini-Tutorial Python

----------------------------------------
import calendar

year = input("Type in the year number:")
calendar.prcal(year)
----------------------------------------
from calendar import prcal

year = input("Type in the year number:")
prcal(year)
----------------------------------------
      
Type in the year number:2001
                                  2001                                  

       January                  February                    March       
Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
 1  2  3  4  5  6  7                1  2  3  4                1  2  3  4     
 8  9 10 11 12 13 14       5  6  7  8  9 10 11       5  6  7  8  9 10 11     
15 16 17 18 19 20 21      12 13 14 15 16 17 18      12 13 14 15 16 17 18     
22 23 24 25 26 27 28      19 20 21 22 23 24 25      19 20 21 22 23 24 25     
29 30 31                  26 27 28                  26 27 28 29 30 31
      
from time import time, ctime

prev_time = ""
while(1):
    the_time = ctime(time())
    if(prev_time != the_time):
        print "The time is:",ctime(time())
        prev_time = the_time
      
The time is: Sun Aug 20 13:40:04 2000
The time is: Sun Aug 20 13:40:05 2000
The time is: Sun Aug 20 13:40:06 2000
The time is: Sun Aug 20 13:40:07 2000
Traceback (innermost last):
  File "clock.py", line 5, in ?
    the_time = ctime(time())
KeyboardInterrupt
      
AnteriorInicioSiguiente