티스토리 뷰


isdigit() 함수를 이용하여 숫자로만 구성되어 있는지 확인한다.


def alpha_string46(s):
    if s.isdigit():
        return True
    elif len(str(s))!=4 and len(str(s)) != 6:
        return False
    else:
        return False

# 아래는 테스트로 출력해 보기 위한 코드입니다.
print( alpha_string46('a234') )
print( alpha_string46('11828') )


댓글
«   2025/11   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
Total
Today
Yesterday