“Python Regex bekommt Wort nach String” Code-Antworten

Python Regex erhalten String vor dem Zeichen

You don't need regex for this

>>> s = "Username: How are you today?"
You can use the split method to split the string on the ':' character

>>> s.split(':')
['Username', ' How are you today?']
Tinky Winky

Python Regex bekommt Wort nach String

regexp = re.compile("name(.*)$")
print regexp.search(s).group(1)
# prints " is ryan, and i am new to python and would like to learn more"
Hanna Solo

Ähnliche Antworten wie “Python Regex bekommt Wort nach String”

Fragen ähnlich wie “Python Regex bekommt Wort nach String”

Weitere verwandte Antworten zu “Python Regex bekommt Wort nach String” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen