python计算字符串中小写字母的数量
import string
s = "pidancode.com 皮蛋编程"
lowercase_count = 0
for c in s:
if c in string.ascii_lowercase:
lowercase_count += 1
print("字符串中小写字母的数量为:", lowercase_count)
import string
s = "pidancode.com 皮蛋编程"
lowercase_count = 0
for c in s:
if c in string.ascii_lowercase:
lowercase_count += 1
print("字符串中小写字母的数量为:", lowercase_count)
相关文章