How to remove the left part of a string split by a delimiter in Python

Splitting a string by the first occurrence of a delimiter splits the string into two parts. Removing the left part of the string returns the remaining right part. For example, splitting the string “abc,d,e,f” by the first comma returns “d,e,f”.

Solution for How to remove the left part of a string split by a delimiter in Python : You can use str.split() to remove the left part of a string split by a delimiter Call str.split(sep, maxsplit) with sep as the string delimiter and maxsplit as 1 to split the string str by the sep from the left maxsplit times. Retreive the left part with splitted[1], where splitted is the result of str.split(sep, maxsplit).


how-to-remove-the-left-part-of-a-string-split-by-a-delimiter-in-python