My texteditor (vim) can give the positions of a string in a string but counts the number of bytes, not the number of characters.
Example:
s="I don't take an apéritif après-ski"
When I search the word apéritif
my texteditor gives the position:
16,25
Python gives this position of the same word:
16,24
Vim gives the possibility to execute python code in the editor.
In one of my python scripts I do a lot of slicing.
But I never find the correct word if there are accented characters in the string.
Is there a way to resolve this in python?
Can I find the byte position of a string in a string in python?