How to find if a string contains another string

Borse, Ganesh ganesh.borse at credit-suisse.com
Tue Oct 30 00:01:57 EDT 2007


Hi,

Am new to python.
May someone please help me know this?

How can we check whether one big string contains another small string?

E.g. 
bigstring="python anaconda boa cobra"
smallone="boa"

If 0 == contains(bigstring,smallone):
        print "Yes, boa is snake.."

Is there any function like "contains" or "exists" in python?
What are different alternatives we have?

Please help.

Thanks and Regards,
Ganesh

==============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer: 

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================




More information about the Python-list mailing list