Python(30)_统计输入的字符串有多少数字

#-*-coding:utf-8-*-
'''
统计用户输入的字符串中有几个数字
'''
#
numList = ['0','1','2','3','4','5','6','7','8','9']
s = input('请输入字符串:')
count = 0
for i in  s:
    if i in numList:
        count +=1
print(count)


 

posted @ 2018-12-30 23:52  sunnybowen  阅读(2448)  评论(0编辑  收藏  举报