把写内容过程比较常用的内容做个备份,下边内容内容是关于python统计字符串中指定字符出现的次数的内容,希望能对大伙有一些用途。
s = "Count, the number of spaces."
print s.count(" ")
x = "I like to program in Python"
print x.count("i")
把写内容过程比较常用的内容做个备份,下边内容内容是关于python统计字符串中指定字符出现的次数的内容,希望能对大伙有一些用途。
s = "Count, the number of spaces."
print s.count(" ")
x = "I like to program in Python"
print x.count("i")