프로그래밍 언어/Python
[Python] 알파벳 자동 생성 방법, 리스트 구현
Yeoo
2022. 10. 1. 08:24
반응형
알파벳 리스트가 필요한데, 일일이 리스트에 입력하기 귀찮다.
그리고 감사하게도 파이썬에는 해당 작업을 import를 통해 쉽게 해결할 수 있다.
from string import ascii_uppercase
cell_list = list(ascii_uppercase)
print(ascii_uppercase)
print(len(ascii_uppercase))
string 모듈에서 ascii_uppercase를 import하여 list형태로 변환하면 리스트에 들어간 알파벳을 쉽게 구현할 수 있다.
소문자로 구현하고 싶으면 하기 import문을 적으면 된다.
from string import ascii_lowercase
반응형