All Samples(3711) | Call(3609) | Derive(0) | Import(102)
replace (str, old, new[, maxsplit]) -> string Return a copy of string str with all occurrences of substring old replaced by new. If the optional argument maxsplit is given, only the first maxsplit occurrences are replaced.
def replace(s, old, new, maxsplit=-1):
"""replace (str, old, new[, maxsplit]) -> string
Return a copy of string str with all occurrences of substring
old replaced by new. If the optional argument maxsplit is
given, only the first maxsplit occurrences are replaced.
"""
return s.replace(old, new, maxsplit)
def containsWords(self, s, ishtml):
if ishtml:
s = string.replace(s, ' ', ' ')
s = string.replace(s, '"', '"')
s = string.replace(s, '©', '')
s = string.replace(s, '<', '<')
s = string.replace(s, '>', '>')
s = string.replace(s, '&', '&')
src/p/o/postmod-HEAD/trunk/postmod/sample_exporter.py postmod(Download)
sampleName = string.strip(sampleName)
sampleFilename = string.strip(sampleFilename)
sampleFilename = string.replace(sampleFilename, "/", "")
sampleFilename = string.replace(sampleFilename, "\\", "")
exportPath = self.exportPath
if self.createDir:
itfname = os.path.basename(itfname)
root, ext = os.path.splitext(itfname)
ext = string.replace(ext, ".", "_")
fnamedir = root
if self.keepExtension:
fnamedir = fnamedir + ext
src/p/o/postmod-HEAD/postmod/sample_exporter.py postmod(Download)
sampleName = string.strip(sampleName)
sampleFilename = string.strip(sampleFilename)
sampleFilename = string.replace(sampleFilename, "/", "")
sampleFilename = string.replace(sampleFilename, "\\", "")
exportPath = self.exportPath
if self.createDir:
itfname = os.path.basename(itfname)
root, ext = os.path.splitext(itfname)
ext = string.replace(ext, ".", "_")
fnamedir = root
if self.keepExtension:
fnamedir = fnamedir + ext
src/e/b/ebmodule-HEAD/examples/test.py ebmodule(Download)
def get_content(book, appendix, hookset, folded, packed):
buffer = []
while 1:
data = eb_read_text(book, appendix, hookset, None)
if not data:
break
data = string.replace(data, "→§", "")
data = string.replace(data, "=→", "=")
data = string.replace(data, "⇒→", "⇒")
data = string.replace(data, "⇔→", "⇔")
buffer.append(data)
data = string.join(buffer, "")
if packed:
data = string.replace(data, "\n", "") + "\n"
src/e/b/ebmodule-HEAD/examples/chujiten.py ebmodule(Download)
def get_content(book, appendix, hookset, folded, packed):
buffer = []
while 1:
data = eb_read_text(book, appendix, hookset, None)
if not data:
break
data = string.replace(data, "", "")
data = string.replace(data, "ᢪ", "")
data = string.replace(data, "͢", "")
data = string.replace(data, "", "")
buffer.append(data)
data = string.join(buffer, "")
if packed:
data = string.replace(data, "\n", "") + "\n"
src/c/y/cycad-HEAD/trunk/src/pexpect-2.0/examples/bd_client_web.py cycad(Download)
def escape_shell_meta_chars(s):
"""Escape shell meta characters. This is done for security."""
s = string.replace(s, "\\", "\\\\")
s = string.replace(s, "`", "\\`")
s = string.replace(s, " ", "\\ ",)
s = string.replace(s, "&", "\\&",)
s = string.replace(s, ";", "\\;",)
s = string.replace(s, "\"", "\\\"",)
s = string.replace(s, "\'", "\\'",)
s = string.replace(s, "|", "\\|",)
s = string.replace(s, "*", "\\*",)
s = string.replace(s, "<", "\\<",)
s = string.replace(s, ">", "\\>",)
src/c/y/cycad-HEAD/src/pexpect-2.0/examples/bd_client_web.py cycad(Download)
def escape_shell_meta_chars(s):
"""Escape shell meta characters. This is done for security."""
s = string.replace(s, "\\", "\\\\")
s = string.replace(s, "`", "\\`")
s = string.replace(s, " ", "\\ ",)
s = string.replace(s, "&", "\\&",)
s = string.replace(s, ";", "\\;",)
s = string.replace(s, "\"", "\\\"",)
s = string.replace(s, "\'", "\\'",)
s = string.replace(s, "|", "\\|",)
s = string.replace(s, "*", "\\*",)
s = string.replace(s, "<", "\\<",)
s = string.replace(s, ">", "\\>",)
src/c/l/clearsilver-0.10.1/clearsilver/python/examples/base/wordwrap.py clearsilver(Download)
def WordWrap(text, cols=70, detect_paragraphs = 0, is_header = 0):
text = string.replace(text,"\r\n", "\n") # remove CRLF
def nlrepl(matchobj):
if matchobj.group(1) != ' ' and matchobj.group(2) != ' ':
repl_with = ' '
else:
repl_with = ''
src/p/y/pyscard-HEAD/trunk/pyscard/src/smartcard/Examples/framework/sample_apduTracerInterpreter.py pyscard(Download)
from smartcard.CardConnectionObserver import CardConnectionObserver from smartcard.util import toHexString from string import replace class TracerAndSELECTInterpreter(CardConnectionObserver):
elif 'command' == ccevent.type:
str = toHexString(ccevent.args[0])
str = replace(str, "A0 A4 00 00 02", "SELECT")
str = replace(str, "A0 C0 00 00", "GET RESPONSE")
print '>', str
src/p/y/pyscard-HEAD/pyscard/src/smartcard/Examples/framework/sample_apduTracerInterpreter.py pyscard(Download)
from smartcard.CardConnectionObserver import CardConnectionObserver from smartcard.util import toHexString from string import replace class TracerAndSELECTInterpreter(CardConnectionObserver):
elif 'command' == ccevent.type:
str = toHexString(ccevent.args[0])
str = replace(str, "A0 A4 00 00 02", "SELECT")
str = replace(str, "A0 C0 00 00", "GET RESPONSE")
print '>', str
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next