Created
February 6, 2013 14:04
-
-
Save rikwatson/4722688 to your computer and use it in GitHub Desktop.
Flatten Tuple
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
# python: how to flatten a tuple | |
# | |
# Basically the problem was that I wanted to create a flat tuple from a tuple and a single value like such: | |
# | |
val = 3 | |
tup = ( 'a', 3.14, "zzz" ) | |
# I wanted this: | |
# | |
# ( 3, 'a', 3.14, "zzz" ) | |
# | |
# not this: | |
# | |
# ( 3, ( 'a', 3.14, "zzz" ) ) | |
print (val,) + tup | |
# Easy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment