Skip to content

cheatsheet - python

Delete

1
2
3
deduplicate = lambda s,c: c.join([substring for substring in s.strip().split(c) if substring])

deduplicate('a    b      c', ' ') # "a b c"