if __name__ == '__main__':
str1 = input('input a string: \n')
str2 = input('input a sub string: \n')
ncount = str1.count(str2)
print(ncount)
python学习===计算字符串中子串出现的次数。
最新推荐文章于 2024-05-03 08:43:15 发布
if __name__ == '__main__':
str1 = input('input a string: \n')
str2 = input('input a sub string: \n')
ncount = str1.count(str2)
print(ncount)