📜  在字符串中查找子字符串,geeksforgeeks - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:31.059000             🧑  作者: Mango

代码示例1
def count_substring(string, sub_string):
    count = 0
    for i in range(len(string)):
        if string[i:].startswith(sub_string):
            count += 1
    return count