'목록하단 광고 치환자(withSeok)
728x90
A200

 

 

A201

# 문자열 처리와 메소드의 이름들
dir(str)

 

A202

# 문자열 구성 파악 메소드
# isdigit 문자열에 숫자만 있는지 판단
vbool1='123456'.isdigit()
print("첫) '123456'.isdigit()",vbool1)

str="1234567"
vbool2=str.isdigit()
print('둘',vbool2)

str1="1234567abc"
vbool3=bool(str1.isdigit())
print('셋',vbool3)

 

A203

# 문자열 구성 파악 메소드
# isalpha 문자열에 대소문자만 있는지 판단
# isalpha 문자열에 글자만 있는지 판단하는 듯
vbool1='ABCD'.isalpha()
print('첫',vbool1)

vbool2='ABCdefg'.isalpha()
print('둘',vbool2)

print('한글',end=" ")
print('한글'.isalpha())
print('한글123',end=" ")
print('한글123'.isalpha())

 

A204

# 문자열 구성 파악 메소드
# isalnum 문자열에 문자+숫자인지 판단
print('isalnum→한글123',end=" ")
print('한글123'.isalnum())
print('isalnum→한글',end=" ")
print('한글'.isalnum())
print('isalnum→abcd#',end=" ")
print('abcd#'.isalnum()) # 특수문자 안됨
print('isalnum→abc d',end=" ")
print('abc d'.isalnum()) # 빈칸도 안됨

 

A205

# 문자열 구성 파악 메소드
# isupper 문자열에 대문자인지 판단
print('isupper→AB',end=" ")
print('AB'.isupper())
print('isupper→ABc',end=" ")
print('ABc'.isupper())
print('isupper→AB한글',end=" ")
print('AB한글'.isupper()) # 소문자가 아닌지 판단하는 듯...
print('isupper→한글만',end=" ")
print('한글만'.isupper()) # 엥?
print('isupper→한글만CC',end=" ")
print('한글만CC'.isupper()) # 이거 뭐지...ㅡㅡ;;;

 

A206

# 문자열 구성 파악 메소드
# islower 문자열에 대문자인지 판단
print('islowe→cd',end=" ")
print('cd'.islower())
print('islowe→cdeF',end=" ")
print('cdeF'.islower())
print('islowe→ab한글',end=" ")
print('ab한글'.islower()) # 이건 또 뭐야..
print('islowe→한글만',end=" ")
print('한글만'.islower()) # 엥?
print('islowe→한글만ff',end=" ")
print('한글만ff'.islower()) # 이거 뭐지...ㅡㅡ;;;

 

A207

# 문자열 구성 파악 메소드
# isspace 문자열에 대문자인지 판단
print('isspace::" "',end=" ")
print(' '.isspace())
print('isspace::',end=" ")
print(''.isspace())
print('isspace::a b',end=" ")
print('a b'.isspace())

 

A208

# 정리 : 문자열 구성 파악 함수
print('123'.isdigit()) # 문자열에 숫자만 있는가?
print('abcABC한글'.isalpha()) # 문자열에 대소문자만 있는가?
print('aB1234'.isalnum()) # 문자열에 글자와 숫자가 있는가?
print('ABC'.isupper()) # 문자열에 대문자만 있는가?
print('cba'.islower()) # 문자열에 소문자만 있는가?
print('    '.isspace()) # 문자열에 빈칸만 있는가?

 

A209

 

 

 

728x90

+ Recent posts