I am newbie to python and don’t know how to do this.
I have a list of tuples which represent data and another list which represents header.
I need a set of combinations into new tuples to look from this.
data = [( 1, 'a'),( 2, 'b'),( 3, 'c'),( 4, 'd'),(5, 'e')]
header = ["ID", "MyData"]
into this
newdata = [("ID", "MyData"),( 1, 'a'),( 2, 'b'),( 3, 'c'),( 4, 'd'),(5, 'e')]
please help.
Here:
Note that this will modify
datain-place. You can achieve the same results without modifying data like so: