“Python Regex Zdobądź słowo po ciągu” Kod odpowiedzi

Python Regex Zdobądź ciąg przed znakiem

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 Zdobądź słowo po ciągu

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

Odpowiedzi podobne do “Python Regex Zdobądź słowo po ciągu”

Pytania podobne do “Python Regex Zdobądź słowo po ciągu”

Więcej pokrewnych odpowiedzi na “Python Regex Zdobądź słowo po ciągu” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu