[Baypiggies] string question
Vikram K
kpguy1975 at gmail.com
Tue Apr 5 22:25:44 CEST 2011
Given a string and some indices, how do i change upper characters
corresponding to some position(s) in the string to lower characters? I tried
and failed.
>>> x = 'EPSPVRYDNLSR'
>>> z = [2, 6]
>>> for i in z:
print x[i]
S
Y
>>> for i in z:
print x[i].lower()
s
y
>>> for i in z:
x[i] = x[i].lower()
Traceback (most recent call last):
File "<pyshell#14>", line 2, in <module>
x[i] = x[i].lower()
TypeError: 'str' object does not support item assignment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20110405/bb9e4bb0/attachment.html>
More information about the Baypiggies
mailing list