코딩테스트를 준비하거나
어떠한 제품에 일련번호를 부여해야할 때 알파벳리스트가 필요할 때가 있다..
그럴 떄 string 모듈을 사용하면 용이하다.
print(string.ascii_lowercase)
print(list(string.ascii_lowercase))
print(list(string.ascii_lowercase)[:4])
abcdefghijklmnopqrstuvwxyz
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
['a', 'b', 'c', 'd']
소문자는 lowercase를
대문자는 uppercase를 이용한다
print(string.ascii_uppercase)
print(list(string.ascii_uppercase))
print(list(string.ascii_uppercase)[:4])
ABCDEFGHIJKLMNOPQRSTUVWXYZ
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
['A', 'B', 'C', 'D']
'python 기초' 카테고리의 다른 글
[python 기초] 순열, 조합 (0) | 2021.12.28 |
---|---|
[python 기초] random 모듈, 무작위 추출 (0) | 2021.12.21 |
[python 기초] 변수명에 format 사용 변수명 for문 (0) | 2021.12.06 |
[python기초] tqdm for문 예상속도, time (0) | 2021.12.06 |
[ python 기초 ] lambda, map, filter (0) | 2021.08.27 |