Notice
Recent Posts
Recent Comments
Link
목록chr (2)
IT 세계의 후아
[python]isdigit()
※ 문자열.isdigit()문자열이 '숫자'로만 구성돼있는지 확인하는 함수따로 chr, ord 함수를 활용하지 않아도 간단하게 풀 수 있음!!# 프로그래머스 lv1 문자열 다루기 기본def solution(s): a = [i for i in s if ord(i)>=48 and ord(i)
Coding/Python
2024. 6. 13. 14:06
[python]아스키코드
※ 내장함수 기억하기!ord(문자) = 아스키코드chr(아스키코드) = 문자print(ord("A")) # 65print(ord("a")) # 97print(ord("z")) # 122print(ord("0")) # 48print(ord("9")) # 57print(chr(65)) # Aprint(chr(48)) # 0# 프로그래머스 lv0 문자 개수 세기# "Programmers" A~z까지 countdef solution(s): li = [0]*52 for i in s: if ord(i) ※ string.ascii_uppercase대소문자 리스트 생성['A', 'B', ..., 'Z'] # ascii_uppercase['a', 'b', ..., 'z'] ..
Coding/Python
2024. 1. 29. 11:23