字符串中查找字母有几个

p = 0
s = 'How can i get there?'
for i in s:
    
    if i == 'P'or i == 'p':
        p = p + 1 
    else:
        continue
    
if p != 0:
    print('',p,'')
else:
    print('')
    
原文地址:https://www.cnblogs.com/wumac/p/5693046.html