MCPcopy Create free account
hub / github.com/ActiveState/code / replace

Method replace

recipes/Python/259100_multireplace/recipe-259100.py:18–33  ·  view source on GitHub ↗
(self,line,new_char)

Source from the content-addressed store, hash-verified

16 if i in self.keep: del self.keep[i]
17
18 def replace(self,line,new_char):
19 bad=0;changed=0
20 #keep on replacing until there are no bad characters left
21 while 1:
22 clean=1
23 for c in line:
24 if c not in self.keep:
25 clean=0
26 line=line.replace(c,new_char)
27 changed=1
28 #cannot continue replacing since line has changed w/for loop
29 break
30 #break the while loop if nothing bad was found
31 if clean: break
32 if self.debug and changed: print line
33 return line

Callers 15

_cleanpathMethod · 0.45
recipe-286216.pyFile · 0.45
_unwindMethod · 0.45
recipe-286217.pyFile · 0.45
dumpDataFunction · 0.45
recipe-298336.pyFile · 0.45
handle_dataMethod · 0.45
rmFunction · 0.45
installVersioningFunction · 0.45
__versionsort__Function · 0.45
__closestVersion__Function · 0.45
__determineVersion__Function · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected