str.startswith(str, beg=0, end=len(string));
startswitch는 문자열안에 문자열이 발견되면 True를 아니면 False을 반환하는 함수이다.
str = "Hello World!!!"
str.startswith("Hello")
str.startswith("hello")
True
False
대소문자를 구별한다.
str = "Hello World!!!"
tuple_str = ("Hello", "World!")
str.startswith(tuple_str)
True
첫번째 인자값은 tuple값은 받는다. 하지만 list값과 dict값은 받지 않는다
2번째, 3번째 인자값은 검색의 시작위치와 끝위치를 지정한다.
str = "Hello World!!!"
str.startswith("World")
str.startswith("World", 6, 11)
False
True
'Python > Python 문법' 카테고리의 다른 글
zip 함수 (0) | 2021.11.25 |
---|---|
sorted(정렬) 함수 (0) | 2021.11.23 |
For문 (0) | 2021.11.19 |
Python 클래스(Class) (0) | 2021.11.11 |
Python ABC(Abstract Base Class) 추상 클래스 (0) | 2021.11.11 |