The string i needed to format is,
string = "How are you? abcdef"
I need to remove the "abcdef" from the string.
The string i needed to format is,
string = "How are you? abcdef"
I need to remove the "abcdef" from the string.
string = string.split(' ')[0]
Edit: Explanation. The line of code above will split the single string into a list of strings wherever there is a double space. It is important to note that whatever is split upon, will be removed. [0]
then retrieves the first element in this newly formed list.