I need to transliterate a Hebrew text. So wrote a little Python script, which reads-in the Hebrew text from a text file, globally replaces the Hebrew letters with Latin ones. Now I need to do some fine tuning (replace certain things in some position but not in other, so a global replace won't do). The trouble is the following: The read-in text is a string so I cannot replace individual string elements. So, what would be the best way to do it?
Python 3, replace in strings
python
Best Answer
Convert your string into a list. Either a list of letters or (if this works in your case) a list of words. This is a basic approach but should work if your string is stored in writing order (rather than display order).