FAQ

Jeff Hinrichs wrote:
def stringReplace(s,c):
"""Remove any occurrences of characters in c, from string s
s - string to be filtered, c - characters to filter"""
for a in c:
s = s.replace(a,'')
return s

It wins also by being easy to understand, no filter or lambda. Not that I
have anything against filter or lambda, but when the speediest method is the
most readable, that solution is definitely the Pythonic champ. :)
Well I really had nothing against the filter, but this solution looks
also acceptable.

Thanks.
Ben.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 19 of 31 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedJul 9, '03 at 7:12a
activeJul 11, '03 at 2:49p
posts31
users15
websitepython.org

People

Translate

site design / logo © 2022 Grokbase