Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. def join_nullable(l: List[str], sep: str) -> str:
  2. """
  3. Filter out None in a list and join the remaining strings.
  4. Example:
  5. Input: l=['a', None, 'c'], sep=' '
  6. Output: 'a c'
  7. :param l: list of strings
  8. :param sep: separator
  9. """
  10. return sep.join(filter(lambda i: bool(i), l))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement