Il 2 aprile 2015 10:52, Alessandro Re <a...@ale-re.net> ha scritto: > def converti_secondi_in_roba_varia(T): > minuti, secondi = divmod(T, 60) > ore, minuti = divmod(minuti, 60) > giorni, ore = divmod(ore, 24) > anni, giorni = divmod(giorni, 365) > secoli, anni = divmod(anni, 100) > return secoli, anni, giorni, ore, minuti, secondi > > converti_secondi_in_roba_varia(12345678) # (0, 0, 142, 21, 21, 18) > > Mancano le settimane, in realtà, mentre i mesi non sono determinabili > correttamente perché cambiano di lunghezza.
Anche gli anni non sono sempre di 365 giorni, in realtà... ;) © -- |:**THE BEER-WARE LICENSE** (Revision 42): | <mi...@python.it> wrote this mail. As long as you retain | this notice you can do whatever you want with this stuff. | If we meet some day, and you think this stuff is worth it, | you can buy me a beer in return. | --Carlo Miron : _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python