Sep-09-2019, 07:24 AM
I am not familiar with Perl code so I have very little understanding what the expected result is. However, if it's about replacement then in simple cases simple str.replace would do:
>>> line = 'Why we never lose?' >>> line.replace('we', 'YOU').replace('lose', 'WIN') 'Why YOU never WIN?' >>> line = 'Why we never lose?' >>> for replacement in (('we', 'YOU'), ('lose', 'WIN')): ... line = line.replace(*replacement) ... >>> line 'Why YOU never WIN?'
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.