Last active
May 20, 2016 23:00
-
-
Save smac89/d06b1b5d778a7b6c91f887d1bc72e789 to your computer and use it in GitHub Desktop.
Version of python's string join which allows for random seperators
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def join_rand(words, *sep): | |
return reduce(lambda joined, new: random.choice(sep).join((joined, new)), words) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment