I have three lists, namely:
commands = ["ping", "exec", "someCmd"]
parameters = ["127.0.0.1", "mspaint", "someParam"]
iterations = ["2", "1", "3"]
as you can imagine, each item index correspond to same index in every list, so I want to have a list of lists where each element corresponds to each program, that is:
[['ping', '127.0.0.1', '2'], ['exec', 'mspaint', '1'], ['someCmd', 'someParam', '3']]
well, that's easy for a beginner like me with a for loop:
new_list = []
for c, _ in enumerate(commands):
row = [commands[c], parameters[c], iterations[c]]
new_list.append(row)
or the actually first that i came up with (i don't know if it's better or worse)
new_list = []
for c, command in enumerate(commands):
row = [command, parameters[c], iterations[c]]
new_list.append(row)
but I don't want to give up and tried to achieve the same with a list comprehension, which i did obviously bad, that's why I'm here
my_attempt = [[c, p, i] for c, p, i in commands, parameters, iterations]
but this surprisingly (for me) just make a list of list but every element is just like the input, that is:
[['ping', 'exec', 'asd'], ['127.0.0.1', 'paint', 'param'], ['2', '1', '3']]
Would you help me to fix this one, or suggest me other approaches?