I have a code with more than 2500 lines that contains several references to GIS layers. I need to replace these layers in the code for several web maps so I have to find a way to automate a find and replace function.
Following a video example, I went on and created my own version of but couldn't get it to work. So, after failing at troubleshooting and googleing I decided to replicate exactly what I see in the video and oh surprise! it turns out it doesn't for me either.
curseWords = ["crap", "butt", "fork"]
niceWords = ["poo", "buttox", "spoon"]
dirtySentence = "You crap, butt in fork"
def Censor(curseWords, niceWords, dirtySentence):
for i in range(len(niceWords)):
dirtySentence = dirtySentence.replace(curseWords[i], niceWords[i])
return dirtySentence
print(dirtySentence)
I expected this code would change dirtySentence
to You poo, buttox in spoon
but it doesn't do it. Anyone has any idea what might be wrong with this piece of code?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…