Python列表问题

s = [' From ',' Moscow ', 'to ' ,' the ' ,' Siberian ',' oil ',' capital ',' of ,' Novosibirsk ' ,' and ,' from ',' the ',' intelectual ',' hub ',' of ,‘ St ',' Petersburg ',' to ' , ' the ', ' nuclear ', ' submarine ' ,' base ',' of ' ,' Murmansk ',' Russians ',' are ', 'searching ',' for ',' a ',' way ' ,' out ',' in ',' anticipation ',' of ',' a ',' grim ',' future ',' in ',' a ',' country ',' torn ',' apart ',' by isolation ', 'censorship ' ,' and ',
' belligerence .']
s1 = s.count("m")
s2 = s.count("M")
print("m出现的次数:",s1)
print("M出现的次数:",s2)

5

[' From ',' Moscow ', 'to ' ,' the ' ,' Siberian ',' oil ',' capital ',' of ,' Novosibirsk ' ,' and ,' from ',' the ',' intelectual ',' hub ',' of ,‘ St ',' Petersburg ',' to ' , ' the ', ' nuclear ', ' submarine ' ,' base ',' of ' ,' Murmansk ',' Russians ',' are ', 'searching ',' for ',' a ',' way ' ,' out ',' in ',' anticipation ',' of ',' a ',' grim ',' future ',' in ',' a ',' country ',' torn ',' apart ',' by isolation ', 'censorship ' ,' and ',
' belligerence .'].count('m')

为啥这两个代码跑出来都是0,怎么计算小m和大m的个数


s = [' From ',' Moscow ', 'to ' ,' the ' ,' Siberian ',' oil ',' capital ',' of ,' Novosibirsk ' ,' and ,' from ',' the ',' intelectual ',' hub ',' of ,‘ St ',' Petersburg ',' to ' , ' the ', ' nuclear ', ' submarine ' ,' base ',' of ' ,' Murmansk ',' Russians ',' are ', 'searching ',' for ',' a ',' way ' ,' out ',' in ',' anticipation ',' of ',' a ',' grim ',' future ',' in ',' a ',' country ',' torn ',' apart ',' by isolation ', 'censorship ' ,' and ',
' belligerence .']

s = "".join(s)

s1 = s.count('m')
s2 = s.count("M")
print("m出现的次数:",s1)
print("M出现的次数:",s2)
不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^