this article illustrates the judgment function of a Python implementation to judge a character in a string. Share to you for your reference, as follows:

 #coding=utf8 # contains two parameters: #containVar: #stringVar: the search contains the character string to search for def containVarInString (containVar, stringVar): try: if isinstance (stringVar, STR): if stringVar.find (containVar): return True else: return False else: return False except Exception, e: print e if __name__== "__main__": if containVarInString ("|", "I found | _ | recommended me | found"): print "12346" /pre> 

"in this example demonstrates whether the string contains Python judgment to determine the function of a character, if you include the return to True, if not contains the return results of




more about Python related content can see the special station: "Python " string manipulation skills summary, "Python data structure and algorithm tutorial " and " Python , summarize the skills in the use of function" Python entry and advanced tutorial classic " and "Python

operation skills summary" the hope for all of us Python programming help.

This concludes the body part