[Python] Problemi con time

Marcello marcello a linuxvil.it
Ven 28 Giu 2013 09:50:50 CEST


OK grazie
ho risolto usando lambda (che non ho mai usato)
ho cercato in rete per capire cosa facesse, ma...... non č che ci ho capito
molto.

import time
tempo = "2013-06-25 16:25:00"
func = lambda obj: obj.strftime('%d/%m/%Y %H:%m')
print func(tempo)


Marcello



Il giorno 28 giugno 2013 05:41, Marco Chieppa | crap0101 <
crap0101 a riseup.net> ha scritto:

> Il giorno Fri, 28 Jun 2013 03:01:02 +0200
> Marcello <marcello a linuxvil.it> ha scritto:
>
> > Ciao a *
> >
> > ho una stringa che recupero da un DB
> > tempo = "2013-06-25 16:25:00"
> >
> > e dovrei modificare in
> > 25/06/2013 16:25
> >
> > potrei utilizzare string per spostare i caratteri, ma vorrei utilizzare
> > time per vari motivi.
> > quindi provo con
> >
> > print time.strftime("%d/%m/%Y %H.%M" ,time.localtime(tempo))
> >
> > [...]
>
> cosė?
>
> >>> tempo = "2013-06-25 16:25:00"
> >>> time.strftime("%d/%m/%Y %H:%M", time.strptime(tempo,"%Y-%m-%d
> %H:%M:%S"))
> '25/06/2013 16:25'
>
> (localtime non si aspetta una stringa)
>
>
>
>
> _______________________________________________
> Python mailing list
> Python a lists.python.it
> http://lists.python.it/mailman/listinfo/python
>
>
-------------- parte successiva --------------
Un allegato HTML č stato rimosso...
URL: <http://lists.python.it/pipermail/python/attachments/20130628/34a4fd9e/attachment.html>


Maggiori informazioni sulla lista Python