argument type

Brian Beck exogen at gmail.com
Mon Dec 27 22:38:24 EST 2004


It's me wrote:
> How do I know if arg1 is a single type (like a number), or a list?

isinstance is probably good enough for your needs.

if isinstance(arg1, (list, tuple, dict)):
     print "arg1 is a container"
else:
     print "arg1 is (probably) not a container"

--
Brian Beck
Adventurer of the First Order



More information about the Python-list mailing list