python 判断网页源码是否含有指定字符串
1个回答
展开全部
python判断一个字符串是否包含另外一个字符串
更多1
字符串包含
子字符串
in方法
#!/usr/bin/env python
#
# [SNIPPET_NAME: String contains string test]
# [SNIPPET_CATEGORIES: Python Core]
# [SNIPPET_DESCRIPTION: Test if a string contains another string]
# [SNIPPET_AUTHOR: Jono Bacon <jono@ubuntu.com>]
# [SNIPPET_LICENSE: GPL]
my_string = "abcdef"
if "abc" in my_string:
has_abc = True
if has_abc == True:
print "String contains string."
更多1
字符串包含
子字符串
in方法
#!/usr/bin/env python
#
# [SNIPPET_NAME: String contains string test]
# [SNIPPET_CATEGORIES: Python Core]
# [SNIPPET_DESCRIPTION: Test if a string contains another string]
# [SNIPPET_AUTHOR: Jono Bacon <jono@ubuntu.com>]
# [SNIPPET_LICENSE: GPL]
my_string = "abcdef"
if "abc" in my_string:
has_abc = True
if has_abc == True:
print "String contains string."
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询