Dec-15-2017, 02:40 AM
i don't remember reading about this, but i decided to try it and see. what could i lose? a few seconds of my time? just trying it beats asking others if it would work, or in simple cases, like this, trying to find it in one of the many documents, references, or tutorials. i had no idea where to look, but i knew where to try it.
i have a structure like
but i spent a few minutes putting together this post. oh, and it worked in both python2 (2.7.12) and python3 (3.5.2).
i have a structure like
['xyzzy','woot',['foo','bar']]
which i wanted to split up into 4 variables. so i could doa, b, temp = structure c, d = tempbut, i wanted to do it in just one line, so i just up and tried this:
a, b, (c, d) = structureand it worked! and it only spent less than a minute of time to discover this ... not more than if i had read the document where this capability is described.
but i spent a few minutes putting together this post. oh, and it worked in both python2 (2.7.12) and python3 (3.5.2).
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.