[Tutor] Type Checking:

Kalle Svensson kalle@gnupung.net
Sat, 3 Mar 2001 18:49:36 +0100


--Kj7319i9nmIyA2yE
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Sez Tim Johnson:
> Hello:
> 	I need to be able to test the type of a variable:
> Consider the following code:
[snip]
> How do I get this code to return=20
> "it's a string"

Howzabout
>>> if type(str) =3D=3D type(""):
or
>>> import types
>>> if type(str) =3D=3D types.StringType:

Peace,
  Kalle
--=20
Email: kalle@gnupung.net     | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD

--Kj7319i9nmIyA2yE
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6oS6wdNeA1787sd0RAitMAJ9azImMrIHUWFN981zuxfAnQStZygCgo+8+
DzADG7b7B95KHh9MT+OseeE=
=0XPy
-----END PGP SIGNATURE-----

--Kj7319i9nmIyA2yE--