I have a string
name = \"Ben\"
that I turn into a list
word = list(name)
I want to replace the characters
Probably you are looking for something like this?
def blankout(instr, r='*', s=1, e=-1):
if '@' in instr:
# Handle E-Mail addresses
a = instr.split('@')
if e == 0:
e = len(instr)
return instr.replace(a[0][s:e], r * (len(a[0][s:e])))
if e == 0:
e = len(instr)
return instr.replace(instr[s:e], r * len(instr[s:e]))