Answer the question
In order to leave comments, you need to log in
How to delete from specific word to specific word?
Hey habr!
I'm not particularly new to Python, and not really a professional, something in between. I thought about how it is possible to remove everything unnecessary from a certain word to a certain word. Let me explain clearly:
Take for example
s = "Ваше имя - Максим, ваша фамилия - Юмиков"
a = s[s.find("-") +2 : ]
print(a)
# И тут оно отображает всё что дальше "-"
Answer the question
In order to leave comments, you need to log in
string = "Ваше имя - Максим, ваша фамилия - Юмиков"
answer = string[string.find("-") + 1:].strip()
answer = answer[:answer.find(',')].strip()
print(answer)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question