목록endswith (1)
IT 세계의 후아
[python]문자열 find, startswith, endswith
※ str.endswith(값, start, end) str의 start, end 위치 내에서 '값'으로 해당 문자열이 끝나는지 확인 # 프로그래머스 접미사 확인 def solution(my_string, is_suffix): return 1 if f in [s[i:] for i in range(len(s))] else 0 # 다른 사람 풀이 return int(my_string.endswith(is_suffix))
Coding/Python
2024. 4. 21. 12:06