Created
February 8, 2017 22:19
-
-
Save chrisvoncsefalvay/0d721e9c666f9a787ea128906e0bab36 to your computer and use it in GitHub Desktop.
All sorts of useful Python hacks...
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
def humanized_join_list(item_list: Union[List, Tuple], ordinary_separator: str = ", ", final_separator=" and "): | |
return final_separator.join([ordinary_separator.join(item_list[:-1]), item_list[-1]] if len(item_list) > 2 else | |
item_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment