Feb-23-2023, 02:21 PM
Got that!
import itertools
S = [['he', 'she'], ['has'], ['1', '2'], ['watch']]
print(list(itertools.product(*S)))
Output: [('he', 'has', '1', 'watch'), ('he', 'has', '2', 'watch'), ('she', 'has', '1', 'watch'), ('she', 'has', '2', 'watch')]
import itertools
S = [['he', 'she'], ['has'], ['1', '2'], ['watch']]
print(list(itertools.product(*S)))
Output: [('he', 'has', '1', 'watch'), ('he', 'has', '2', 'watch'), ('she', 'has', '1', 'watch'), ('she', 'has', '2', 'watch')]