class Solution(object):
def strStr(self, haystack, needle):
"""
:type haystack: str
:type needle: str
:rtype: int
"""
if needle in haystack:
return haystack.find(needle)
return -1
class Solution(object):
def strStr(self, haystack, needle):
"""
:type haystack: str
:type needle: str
:rtype: int
"""
# if needle in haystack:
return haystack.find(needle)
# return -1
파이썬 문자열 함수