[ create a new paste ] login | about

Link: http://codepad.org/Ul18tkGO    [ raw code | output | fork ]

jonlyles - Python, pasted on Nov 9:
1
2
3
4
5
6
7
8
9
10
11
12
def censor(text,word):
  list = text.split()
  counter = 0
  for i in list:
    if i == word:
      list[counter] = "*" * len(word)
    counter = counter + 1
  string = ' '.join(list)
  return string

val = censor("hey hey hey","hey")
print val


Output:
1
*** *** ***


Create a new paste based on this one


Comments: