[Python] Funzione type()

Diego Barrera diegonebarrera a yahoo.it
Mar 25 Ott 2011 09:55:48 CEST


Il 25/10/2011 09:24, lordkrandel ha scritto:
> Python 3.1 sulla mia macchina
>
> >>type(1) is int
> True
>
> >>class a:
> ...   pass
> >>b = a()
> >>type(b) == a
> True
>
> Questo ad una prima occhiata, puņ essere utile?
>
Magari puo' essere utile a qualcuno inesperto come me..
ho fatto qualche prova; funzionano tutti questi test:

type(x) is datetime.date
type(x) == datetime.date
isinstance(x,datetime.date)

l'importante e' importare il modulo datetime!!!
:)

grazie diego


Maggiori informazioni sulla lista Python