Код: Выделить всё
r'\w+\-\w+
< /code>
Я хотел бы заменить его на < /p>
r'\w+\s\-\s\w+
< /code>
[b] Пример: < /strong>
Я хотел бы изменить < /p>
hello-friends to hello - friends
Код: Выделить всё
df['mytextcolumn'].str.replace(r'(\\w+)(\\-)(\\w+)',r'(\\w+)(\\s)(\\-)(\\s)(\\w+)')
Код: Выделить всё
re.sub(r'\\w+\\-\\w+',r'\\w+\\s\\-\\s\\w+','hello-friends')
but I still get back hello-friends, not hello - friends
Подробнее здесь: https://stackoverflow.com/questions/729 ... eplacement