Find a substring withing a string...

FooBar abc at attbi.com
Sat Jun 21 01:39:15 EDT 2003


	OK I will be the first to admit that I am VERY new to Pythin and 
know little of the syntax of this language.  I want to perform the 
simple task of testing to see if a substring exists within string.  I 
think the syntax is find(sting,substring) and the return is -1 if the 
substirng is not found otherwise the start position of the substring in 
the string.  is this correct?

	Moreover is this code totally screwed?


takeaction = find(stringvar,'LITERALSUB')
if takeaction != -1:
    action_to_take_if_found
else:
    action_tp_take_if_not_found


	Any help with this is appreciated as I am a total DFU when it 
comes to this for now anyway...


Thanks,
DB




-- 



http://www.TheHappyCat.com
Please Help the Unwanted and Homeless Animals!







More information about the Python-list mailing list