L
L
LakeForest2021-10-04 06:50:33
Python
LakeForest, 2021-10-04 06:50:33

How to move the + symbol in a string through a regular expression: hello+t -> hello+et?

to + stand before the stressed vowel

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2021-10-04
@LakeForest

Why is there a regular?

text = 'приве+т'

symbol = '+'   # символ
shift_pos = -1 # на сколько подвинуть

pos = text.find(symbol)
out = text[:pos] + text[pos+1:]
out = f'{out[:pos+shift_pos]}{symbol}{out[pos+shift_pos:]}'

print(out)
# прив+ет

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question