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")