replace value of a specific position

Sean Ross sross at connectmail.carleton.ca
Thu Jul 10 20:06:48 CEST 2003


"Joe Francia" <usenet at soraia.com> wrote in message
news:3F0DA6FB.90603 at soraia.com...
[snip]
>  >>> t = '010010101001001110100101010111'
>  >>> t = string.join([t[:5], '2', t[6:]], '')
>  >>> t
> 010012101001001110100101010111


# or, without importing the string module:
>>> t = '010010101001001110100101010111'
>>> t = ''.join((t[:5],'2',t[6:]))
>>> t
'010012101001001110100101010111'






More information about the Python-list mailing list