Indentifying types?

andrew cooke andrew at acooke.org
Tue Mar 3 12:58:32 EST 2009


either will work for what you want.  people in the python list prefer
python.  you only have to post a question once.  this gives an idea of the
relative popularity and trends:
http://www.google.com/trends?q=python+language%2C+perl+language

andrew

Oltmans wrote:
> I'm reading from a file that contains text like
>
> ----
> 5
> google_company
> apple_fruit
> pencil_object
> 4
> test_one
> tst_two
> ----
>
> When I read the integer 5 I want to make sure it's an integer.
> Likewise, for strings, I want to make sure if something is indeed a
> string. So how do I check types in Python? I want to check following
> types
>
> 1- integers
> 2- strings
> 3- testing types of a particular class
> 4- decimal/floats
>
> Please excuse my ignorance & enlighten me. I will really appreciate
> any help.
>
> Thanks,
> Oltmans
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>





More information about the Python-list mailing list