Strip a set of characters from a string: Difference between revisions
Content added Content deleted
No edit summary |
(added python) |
||
Line 56:
Sample output:
<pre>Sh ws soul strppr. Sh took my hrt!</pre>
=={{header|Python}}==
<lang python>>>> def stripchars(s, chars):
... return "".join(c for c in s if c not in chars)
...
>>> stripchars("She was a soul stripper. She took my heart!", "aei")
'Sh ws soul strppr. Sh took my hrt!'</lang>
[[Category:String manipulation]]
|