Python ProgrammingPython Programming

How to replace the first character alone in a string in Python?

str1 = "caars caars caars"
str2 = str1.replace('aa', 'a', 1)

print(str2)
Output
cars caars caars