[Tutor] type() problem

Knacktus knacktus at googlemail.com
Sun Aug 22 19:47:09 CEST 2010


> fruit="ramadana"
> print "fruit heeft als type", type(fruit)
> y=len(fruit)
> print y
>
> z=fruit[:3]
> print z
>

These lines put in a module and executed print (using Python 2.7):

fruit heeft als type <type 'str'>
8
ram

Strange that it doesn't work for you.

I can only advice you to check the file again or run the code from the 
Python shell.

HTH,

Jan




More information about the Tutor mailing list