[Tutor] How to learn messages frim help()?
rabidpoobear at gmail.com
Mon Jul 10 07:39:45 CEST 2006
> and get message as following:
[snip help output]
> Have TYPE defined these methods?
> What relation with __call__,__cam__ etc?
don't think you're supposed to actually deal with the class called 'type'.
I assume you're referring to typecasting variables.
What it means when it says 'type()' is, for example,
str( ), int( ) etc.
Take the following example.
>>> a = 2
>>> print a
>>>print 'your number is '+a
TypeError: cannot concatenate str and int objects.
>>>print 'your number is '+str(a)
your number is 2
note that you could just do
>>> print 'your number is %s.' % a
your number is 2.
that will take care of the type conversion for you.
More information about the Tutor