Possible Duplicate:
Delete Chars in Python
I want to know how to delete strings after a keyword in python
I will get lines in a txt file
What method could I use to do this.
For example:
“I have a book to read.”
I want to delete all words after “book”.
To remove everything after the first “book” including “book” itself:
To preserve the word “book”:
Both work whether “book” present in the string or not.