Python str.find()
사용 버전 : Python 3.6.8
사용 프로그램 : Atom 1.35.1 x64
str.find()는 문자열이 몇 번째 위치에 존재하는지 반환합니다.
반환되는 숫자는 존재하는 인덱스의 가장 낮은 숫자를 반환합니다.
아무것도 적지 않으면, 전체 문자열에서 검색합니다.


만약 존재하지 않다면, '-1'을 반환합니다.


시작 위치와 끝 위치를 적으면, 해당 위치 사이에서 검색합니다.
slice된 문자열에서 검색하는 것과 동일합니다.




끝.
사용 프로그램 : Atom 1.35.1 x64
파이썬 str.find()에 대해서 알아보겠습니다.
괄호 안에는 찾을 문자, 시작 위치, 마지막 위치가 표기됩니다.
str.find()는 문자열이 몇 번째 위치에 존재하는지 반환합니다.
반환되는 숫자는 존재하는 인덱스의 가장 낮은 숫자를 반환합니다.
아무것도 적지 않으면, 전체 문자열에서 검색합니다.


만약 존재하지 않다면, '-1'을 반환합니다.


시작 위치와 끝 위치를 적으면, 해당 위치 사이에서 검색합니다.
slice된 문자열에서 검색하는 것과 동일합니다.




끝.
카테고리: Standard Library, Python
댓글
댓글 쓰기
궁금한 점은 댓글 달아주세요.
Comment if you have any questions.