小编pal*_*lak的帖子

我必须检查字符串是否包含:字母数字、字母、数字、小写和大写字符

def fun(s):
    for i in s:
        if i.isalnum():
            print("True")
        if i.isalpha():
            print("True")
        if i.isdigit():
            print("True")
        if i.isupper():
            print("True") 
        if i.islower():
            print("True")
s=input().split()
fun(s)
Run Code Online (Sandbox Code Playgroud)

为什么即使它在 for 循环中也只打印一次 true

python string python-3.x

6
推荐指数
1
解决办法
7626
查看次数

标签 统计

python ×1

python-3.x ×1

string ×1