Replacing string-characters


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?
 
Ad

Advertisements

jgm

Joined
Sep 24, 2006
Messages
5
Reaction score
0
Stop sending garbage to our newsgroup

This is a serious newsgroup.

I ask the moderator (there is one?) to stop this kind of posts that put dirty in this newsgroup created for Python programmers, not for swindlers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top