本文介绍了如何确定子字符串是否在不同的字符串中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个子字符串:
substring = "请帮帮我"我还有一个字符串:
string = "请帮我解决这个问题"如何使用 Python 确定 substring 是否是 string 的子集?
解决方案with in: substring in string:
>>>substring = "请帮帮我">>>string = "请帮我解决这个问题">>>字符串中的子字符串真的I have a sub-string:
substring = "please help me out"I have another string:
string = "please help me out so that I could solve this"How do I find if substring is a subset of string using Python?
解决方案with in: substring in string:
>>> substring = "please help me out" >>> string = "please help me out so that I could solve this" >>> substring in string True
更多推荐
如何确定子字符串是否在不同的字符串中
发布评论