python 整数中1出现的次数(从1到n整数中1出现的次数) python 整数中1出现的次数(从1到n整数中1出现的次数) python"># -*- coding:utf-8 -*- class Solution: def NumberOf1Between1AndN_Solution(self, n): count = 0 for item in range(1,n+1): pstr = str(item) count += pstr.count('1') return count 标签:python