What is the easiest way in Python to replace a character in a string?
For example:
text = \"abcdefg\"; text[1] = \"Z\"; ^
Actually, with strings, you can do something like this:
oldStr = 'Hello World!' newStr = '' for i in oldStr: if 'a' < i < 'z': newStr += chr(ord(i)-32) else: newStr += i print(newStr) 'HELLO WORLD!'
Basically, I'm "adding"+"strings" together into a new string :).