I am looking for a way to extend a header of a CSV file.
I have the file header in a dictionary (dict1) and another dictionary (dict2) with keys that some are duplicates of dict1 and would like to extend the header in the file.
I was told there is something like csv.header.extend() but not sure how it works and couldn't find examples.
My CSV looks like:
V,T1,T2,T3,T4
U1,a,b,c,d
U2,q,w,e,r
Lets say dict2 is
dict2 = {'V': 'U3', 'T1': 'p', 'T2': 'o', 'T5': 'z'}
The CSV would come out like this:
V,T1,T2,T3,T4,T5
U1,a,b,c,d,
U2,q,w,e,r,
U3,p,o,,,z
Anyone knows how this would work?