Skip to content

Instantly share code, notes, and snippets.

@westscz
Created June 24, 2020 15:04
Show Gist options
  • Select an option

  • Save westscz/a26d065db2b8c4337d43c802893c856c to your computer and use it in GitHub Desktop.

Select an option

Save westscz/a26d065db2b8c4337d43c802893c856c to your computer and use it in GitHub Desktop.
sentence = "Words like herself and researcher also get censored but only her, should her."
new_words = []
for word in sentence.split():
if word.replace(',', "").replace('.', "") == 'her':
word = '***'+word[3:]
new_words.append(word)
new_sentence = " ".join(new_words)
print(new_sentence)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment