【发布时间】:2018-03-21 04:09:30
【问题描述】:
如何使用python reduce函数查找给定字符串“string”中存在的“char”数量?
我刚刚了解 reduce。它只会返回一个元素。所以我认为应该有办法使用 reduce 来完成这项工作。
目前没有找到。
示例:
char:'s'
inputstring:'assntcs'
output(number of occurrence of s in 'assntcs'):-3
【问题讨论】:
标签: python python-3.x