Most efficent way to create all possible combinations of four lists in Python?
- by Baresi
I have four different lists. headers, descriptions, short_descriptions and misc. I want to combine these into all the possible ways to print out:
header\n
description\n
short_description\n
misc
like if i had (i'm skipping short_description and misc in this example for obvious reasons)
headers = ['Hello there', 'Hi there!']
description = ['I like pie', 'Ho ho ho']
...
I want it to print out like:
Hello there
I like pie
...
Hello there
Ho ho ho
...
Hi there!
I like pie
...
Hi there!
Ho ho ho
...
What would you say is the best/cleanest/most efficent way to do this? Is for-nesting the only way to go?