Related questions
Print string to text file
I'm using Python to open a text document:
text_file = open("Output.txt", "w")
text_file.write("Purchase Amount: " 'TotalAmount')
text_file.close()
I want to substitute the value of a string variable TotalAmount into the text document. Can someone …
How to replace multiple substrings of a string?
I would like to use the .replace function to replace multiple strings.
I currently have
string.replace("condition1", "")
but would like to have something like
string.replace("condition1", "").replace("condition2", "text")
although that does not feel like good syntax
what …