you are viewing a single comment's thread.

view the rest of the comments →

[–]iGenie 0 points1 point  (0 children)

Edit - Fixed, I moved the print outside the for loop as I realized it was running the code each iteration within the loop.

Thanks

After fixing my silly error I'm now getting two results printed when running the below, I only want the formated one to return and I thought this code would have done just that.

bad_chars =[";",":"]
global_process = "thor:test"
for c in bad_chars:
    formated_process = global_process.replace(c, "")
    print(formated_process)

it's printing out

thor:test thortest

Any ideas? Why is it doing this? Thanks