- Joined
- Oct 19, 2006
- Messages
- 1
- Reaction score
- 0
I want to exchange charas in a string at specific positions within the string. If I were writing in Pascal, it would be:
delete(source,ipos,inum); { remove inum charas (probably 1), starting at position ipos, from source }
insert(newchars,source,ipos); { insert newchars (probably 1) into source, at position ipos }
Dead easy.
I've looked at the String Methods (para 3.6.1 of the Python Library Reference) but have been unable to find any method/combination of methods to perform this. Am I missing something, or is it not possible in Python? If the latter, can someone say how I achieve it, perhaps using some other type. Thanks
BTW, I can't seem to get the .replace method to work at all, is there a known problem with it?
delete(source,ipos,inum); { remove inum charas (probably 1), starting at position ipos, from source }
insert(newchars,source,ipos); { insert newchars (probably 1) into source, at position ipos }
Dead easy.
I've looked at the String Methods (para 3.6.1 of the Python Library Reference) but have been unable to find any method/combination of methods to perform this. Am I missing something, or is it not possible in Python? If the latter, can someone say how I achieve it, perhaps using some other type. Thanks
BTW, I can't seem to get the .replace method to work at all, is there a known problem with it?