How do I modify a single character in a string, in Python? Something like:
a = \"hello\" a[2] = \"m\"
\'str\' object does not support ite
In python, string are immutable. If you want to change a single character, you'll have to use slicing:
a = "hello" a = a[:2] + "m" + a[3:]