공부
[Python] search keyword
승가비
2021. 2. 9. 01:30
728x90
st1 = "Hello World!"
st2 = "World"
idx = st1.find(st2)
if idx == -1:
print('not exist')
else:
print('exist at idx', idx)
스트링에 특정 단어 위치 찾기
java의 contains나 indexOf같은 메소드가 있을까요? 이렇게 쓰려구요. if not somestring.contains("찾고 싶은 문자열"): continue
hashcode.co.kr
728x90