I have read all the python docs on String.replace
, yet I am still having trouble with my code. My code is as follows:
#within a class
def fixdata(self):
global inputs_list
for i in range(0, len(inputs_list)):
inputs_list[i].replace("\n", "")
print(inputs_list[i]) # to check output
What I am hoping for is that all \n
characters (newlines) are replaced with empty string ""
so that trailing newlines are removed. .strip()
, .rstrip()
, and, I'm assuming, .lstrip()
do not work.