Searching for a piece of string

rishi pathak mailmaverick666 at gmail.com
Thu May 3 03:50:43 EDT 2007


s="CastinTime"
if s.find("Time") != -1:
    print "found"
else:
    print "not found"

On 3 May 2007 00:35:57 -0700, saif.shakeel at gmail.com <saif.shakeel at gmail.com>
wrote:
>
> Hi,
>     How can i match a part of string and branch to some part of code.
> Ex If there is a string like "Timeout" and i want to search only
> whether the word "Time" is present in it(which is valid in this
> case).so if i have "CastinTime",still this should hold.
>    I need to use this in a "if" statement and code.Can someone help me
> in this.
>                            Thanks .
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Regards--
Rishi Pathak
National PARAM Supercomputing Facility
Center for Development of Advanced Computing(C-DAC)
Pune University Campus,Ganesh Khind Road
Pune-Maharastra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070503/c0d6e524/attachment.html>


More information about the Python-list mailing list