En Wed, 19 Dec 2007 21:59:25 -0300, jolly <[EMAIL PROTECTED]> escribió:
> I'm following a tutorial on Python and I came across this in one of > the examples. > > import time > > today = time.localtime(time.time()) > theDate = time.strftime("%A %B %d", today) > > print today > print theDate > > > Result: > > > (2007, 12, 20, 9, 48, 15, 3, 354, 1) > Thursday December 20 > > > can someone explain to me the %A and the %B? The format is documented in the Library Reference, at <http://docs.python.org/lib/module-time.html#l2h-2816> %A is Locale's full weekday name (Thursday in your example) %B is Locale's full month name (December in your example) If you want to see how all other formats work: import time import string now = time.localtime() for char in string.ascii_letters: fmt = "%"+char try: result = time.strftime(fmt, now) except: pass else: if result: print "%s\t%s" % (fmt, result) This is my output: %a Wed %b Dec %c 12/19/07 22:31:40 %d 19 %j 353 %m 12 %p PM %w 3 %x 12/19/07 %y 07 %z Hora est. de Sudamérica E. %A Wednesday %B December %H 22 %I 10 %M 31 %S 40 %U 50 %W 51 %X 22:31:40 %Y 2007 %Z Hora est. de Sudamérica E. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list