Use the split() method to cut string after the character in Python. This split method returns the list of separated subtrings.
Python cut string after the character and Print example
Simple example code cut after “-” char in a given string. Must max split value 1 to split the string at the first occurrence of sep into a list.
Access this list’s 1 index element value to get a string with everything after the sep character.
s = "Python Programing - code example" res = s.split("-", 1) print(res)
Do comment if you have any doubts and suggestions on this Python char string topic.
Note: IDE: PyCharm 2021.1.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.