统计字符串里面有多少个阿拉伯数字。
s = "I am sylar, I'm 14 years old, I have 2 dogs!"
count = 0
for c in s:
if c.isdigit():
count = count + 1
print(count)
运行结果:
标签:count,里面,阿拉伯数字,字符串,多少,统计 From: https://www.cnblogs.com/libinghui/p/17811251.html
统计字符串里面有多少个阿拉伯数字。
s = "I am sylar, I'm 14 years old, I have 2 dogs!"
count = 0
for c in s:
if c.isdigit():
count = count + 1
print(count)
运行结果:
标签:count,里面,阿拉伯数字,字符串,多少,统计 From: https://www.cnblogs.com/libinghui/p/17811251.html