gpt4 book ai didi

python - 如何确定子字符串是否在不同的字符串中

转载 作者:IT老高 更新时间:2023-10-28 21:07:03 27 4
gpt4 key购买 nike

我有一个子字符串:

substring = "please help me out"

我还有一个字符串:

string = "please help me out so that I could solve this"

如何使用 Python 查找 substring 是否是 string 的子集?

最佳答案

with in: 字符串中的子字符串:

>>> substring = "please help me out"
>>> string = "please help me out so that I could solve this"
>>> substring in string
True

关于python - 如何确定子字符串是否在不同的字符串中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7361253/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com