replacing substrings within strings
Rune Strand
rune.strand at gmail.com
Wed Feb 14 07:56:05 EST 2007
Or, slighly slower, but more general:
def swap(s, order=(3,4,2,0,1)):
# assert len(s) >= len(order)
return ''.join([s[o] for o in order]) + s[6:]
More information about the Python-list
mailing list