what errors are you getting? Could it be an indentation error? I don't see anything wrong with the script except the value of fruit is missing. if fruit is a string, it should work like a charm. double check the length of the fruit with print len(fruit) and check fruit with print type(fruit) and make sure it really is a 'str'. Also, fruit has to already exist in the script e.g. 'fruit = apple'. Next time post your errors too.
-- http://mail.python.org/mailman/listinfo/python-list