I have two dicts as of below:
dict1 = {'name':'john', 'age':43}
dict2 = {'sex':'male', 'place':'southafrica'}
Note: dict2
's keys and values can change all the time
How do we combine two dicts like this:
res = {'name':'john', 'sex':'male', 'place':'southafrica'}
I want to write this into a txt file with delimiter '|' like below"
name|sex|place
john|male|southafrica
How can we achieve this with python?