0

How would I remove everything before a certain word once the word is found?(Python)

For example: x=input() #users types ā€˜jsnhandkqkvā€™ Now I want to cut off everything before the word hand but I need it to work no matter where hand is typed, how would I do this?

19th Feb 2022, 6:17 PM
Bailey
5 Answers
19th Feb 2022, 6:31 PM
Ion Kare
Ion Kare - avatar
+ 1
If you would like to remove something before you can use eomething like for example user_input.lstrip('keyword', 'start word' 'endword')
19th Feb 2022, 6:38 PM
Ion Kare
Ion Kare - avatar
+ 1
x = 'footballer' x=x[x.find('ball'):] print(x) Hope this helps
21st Feb 2022, 1:21 PM
eskayML šŸ’£
eskayML šŸ’£ - avatar
0
del x[index:index:index]
19th Feb 2022, 6:32 PM
A J
A J - avatar
0
Thank you
19th Feb 2022, 6:33 PM
Bailey