You don't need to define a string as a list in python.

string = 'The quick brown fox jusmps over the lazy dog'
# Define your variables
result = ''
for i in string:
        if i == 'o':
                i = '0'
        result += i
print result

If you MUST however use a list:

string = list('The quick brown fox jusmps over the lazy dog')
result = []
for i in string:
        if i == 'o':
                i = '0'
        result.append(i)
print ''.join(result)
Answer from Alexander Ejbekov on Stack Overflow
🌐
W3Schools
w3schools.com › python › ref_string_replace.asp
Python String replace() Method
Remove List Duplicates Reverse a String Add Two Numbers · Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Training ... The replace() method replaces a specified phrase with another specified phrase.
Discussions

python - Replacing instances of a character in a string - Stack Overflow
to use the .replace() method effectively on string without creating a separate list for example take a look at the list username containing string with some white space, we want to replace the white space with an underscore in each of the username string. names = ["Joey Tribbiani", "Monica Geller", "Chandler Bing", "Phoebe Buffay"] usernames = [] to replace the white spaces in each username consider using the range function in python... More on stackoverflow.com
🌐 stackoverflow.com
Python: How can I replace one specific character on a string while leaving the rest of the string as it was?
str.replace replaces all instances of the search string with the replacement string, which isn't what you want the correct solution would be to turn the string into a list, update the value at the wanted index and then "".join(char_list) to rebuild the string More on reddit.com
🌐 r/learnprogramming
12
6
October 18, 2023
Python replace character without replace method - Stack Overflow
Now I know you can use the replace ... standard python function ? ... You get the error because strings are immutable. Hence, any solution will just return a new object. However, why do you want to use a non standard function? Is a regex non standard? Are list comprehensions nonstandard? What is bad about replace? Additionally, the question in it's current ... More on stackoverflow.com
🌐 stackoverflow.com
August 17, 2017
Str.replace of a set of characters - Ideas - Discussions on Python.org
I would like str.replace, when given a set of characters, to replace occurrence of any of the characters in the set. I.e. 'ASDFGH'.replace(set('SFH'), '') == 'ADG' should then hold. It would mean I would not have to go to the trouble of using the re module for a common string operation. More on discuss.python.org
🌐 discuss.python.org
0
December 1, 2019
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-string-replace
Python String replace() | DigitalOcean
August 3, 2022 - Technical tutorials, Q&A, events — This is an inclusive place where developers can find or lend support and discover new ways to contribute to the community.
🌐
freeCodeCamp
freecodecamp.org › news › python-string-replace-how-to-replace-a-character-in-a-string
Python string.replace() – How to Replace a Character in a String
September 1, 2022 - The new_char argument is the set of characters that replaces the old_char. The count argument, which is optional, specifies how many occurrences will be replaced. If this is not specified, all occurrences of the old_char will be replaced with the new_char. Let's see some examples. Here's an example that replaces "JavaScript" with "PHP" in a string: str = "I love JavaScript. I prefer JavaScript to Python because JavaScript looks more beautiful" new_str = str.replace("JavaScript", "PHP") print(new_str) # I love PHP.
🌐
StrataScratch
stratascratch.com › blog › how-to-replace-a-character-in-a-python-string
How to Replace a Character in a Python String - StrataScratch
October 18, 2024 - There are several ways to replace a character in a Python string. In this article, you’ll learn three main techniques and how to use them in practice.
🌐
Mimo
mimo.org › glossary › python › string-replace-method
Master Python's String Replace Method for Text Manipulation
You can also use replace() to replace single characters in a string rather than substrings.
Find elsewhere
🌐
FavTutor
favtutor.com › blogs › replace-character-string-python
Python Replace Character in String | FavTutor
October 6, 2021 - Learn how to replace a character in a string in python by using replace () method. Also, understand python strings with example.
🌐
Scaler
scaler.com › home › topics › replace a character in a string python
Replace a Character in a String Python - Scaler Topics
April 20, 2024 - One of the most widely used ways is using the Python built-in method string.replace(). The .replace() method replaces the old character with a new character. We can also use loops to replace a character in a string in Python. The string slicing method can also be used to replace a string in python.
🌐
GeeksforGeeks
geeksforgeeks.org › python-string-replace
Python String replace() Method - GeeksforGeeks
October 28, 2024 - It works by returning True when the string consists of digits from 0 to 9 and False otherwise. This method is especially useful when we want to ensure that user inputs or string data are stri ... The isdigit() method is a built-in Python function that checks if all characters in a string are digits.
🌐
Real Python
realpython.com › replace-string-python
How to Replace a String in Python – Real Python
October 22, 2025 - In this tutorial, you'll learn how to remove or replace a string or substring. You'll go from the basic string method .replace() all the way up to a multi-layer regex pattern using the sub() function from Python's re module.
🌐
Keploy
keploy.io › home › community › how to replace strings in python?
How to Replace Strings in Python: Methods, Examples & Best Practices
September 26, 2025 - Since Python strings are immutable, they can’t be changed directly, but Python provides multiple easy ways to handle replacements. In this guide, we’ll explore different methods to replace strings in Python using replace(), slicing, lists, translate(), and regex with clear examples and best practices. In Python, a string is a sequence of characters enclosed in quotes.
🌐
Mimo
mimo.org › tutorials › python › how-to-replace-characters-in-a-string-in-python
How to Replace Characters in a String in Python
Replace characters in Python strings with replace() or translate(), including limits and multi-character swaps.
🌐
Server Academy
serveracademy.com › blog › python-replace-function
Python Replace() Function Blog | Server Academy
November 14, 2024 - The method in Python is a powerful tool for working with strings, allowing you to replace parts of a string with new values. Whether you’re changing characters…
🌐
Tutorialspoint
tutorialspoint.com › python › string_replace.htm
Python String replace() Method
But, since we have passed the count as 0, this method does not modify the current string, instead of that, it returns the original value ("Learn Python from Tutorialspoint"). str = "Learn Python from Tutorialspoint" strreplace = str.replace("Python", "Java", 0) print("String after replacing: " + strreplace)
🌐
Stack Overflow
stackoverflow.com › q › 35112917
string - python replace character without replacing already replaced characters - Stack Overflow
I try to replace characters in mystr = 'AC' according to dict d = {'A':'C', 'C':'B'}. However, I will not replace all at once. I will replace characters in Key order one by one (I do some calculation
🌐
Python.org
discuss.python.org › ideas
Str.replace of a set of characters - Ideas - Discussions on Python.org
December 1, 2019 - I would like str.replace, when given a set of characters, to replace occurrence of any of the characters in the set. I.e. 'ASDFGH'.replace(set('SFH'), '') == 'ADG' should then hold. It would mean I would not have to go …
🌐
Programiz
programiz.com › python-programming › methods › string › replace
Python String replace()
If the old substring is not found, it returns a copy of the original string. ... # replacing 'cold' with 'hurt' print(song.replace('cold', 'hurt')) song = 'Let it be, let it be, let it be, let it be'