Muy buenas, Supongo que estás usando Python 2 porque en Python 3 todas las líneas que has puesto fallan. Es por el 0 a la izquierda en el segundo y en el tercer argumento: en Python 2 los literales enteros que empiezan por 0 definen un entero en base octal [1]. Por eso falla al llegar a 08, porque 8 no tiene sentido en base 8.
Esto se cambió en Python 3 [2] y ahora no hay ambiguedad: los literales enteros no pueden empezar por cero. [1]: http://docs.python.org/reference/lexical_analysis.html#integer-and-long-integer-literals [2]: http://docs.python.org/py3k/reference/lexical_analysis.html#integer-literals Por cierto, esto de "literales enteros" me suena mal, tal vez por estar acostumbrado al inglés. ¿Alguien tiene alguna sugerencia distinta? Un saludo, Juan Luis Cano 2012/1/2 Jhonny5 <[email protected]> > Muy buenas, > > a ver si alguien me sabe decir el porqué de esto: > > >>> import calendar > >>> calendar.weekday(2012,01,02) > 0 > >>> calendar.weekday(2012,01,03) > 1 > >>> calendar.weekday(2012,01,04) > 2 > >>> calendar.weekday(2012,01,05) > 3 > >>> calendar.weekday(2012,01,06) > 4 > >>> calendar.weekday(2012,01,07) > 5 > >>> calendar.weekday(2012,01,08) > File "<stdin>", line 1 > calendar.weekday(2012,01,08) > ^ > SyntaxError: invalid token > > > Duda: por qué ese error de sintaxis. > > > Gracias, > j. > > -- > talueee.com > > Linux User #236965 (counter.li.org) > key: http://talueee.com/gpg/jhonny5.asc > Po fueno, po fale, po malegro. > > > _______________________________________________ > Python-es mailing list > [email protected] > http://mail.python.org/mailman/listinfo/python-es > FAQ: http://python-es-faq.wikidot.com/ > >
_______________________________________________ Python-es mailing list [email protected] http://mail.python.org/mailman/listinfo/python-es FAQ: http://python-es-faq.wikidot.com/
