https://github.com/w5678/leetcode-2021https://github.com/w5678/leetcode-2021力扣
class Solution:
def reversePrefix(self, word: str, ch: str) -> str:
idx = word.find(ch)
return word if idx== -1 else word[0:idx+1][::-1]+ word[idx+1:]
真的是练语法的