python判断字符串包含的方法,所有语言中,python的这种判断方法可以说是最直观简单的。
#!/usr/bin/env python
#
# [代码名字: String contains string test]
# [代码分类: Python Core]
# [代码描述: Test if a string contains another string]
# [代码作者: Jono Bacon <jono@ubuntu.com>]
# [代码协议: GPL]
my_string = "abcdef"
if "abc" in my_string:
has_abc = True
if has_abc == True:
print "String contains string."
