I have two lists:
a = ['Peter', '1982', '2000', 'Homeland', '10.34']
b = ['Peter', '1982', '2000', 'Homelnad', '10.32']
and I want comlete diff.
So I want output like this:
[”, ”, ”, ”, ‘10.32’]
So I want just changed values at right place.
Is there some built in function for this? What is fastest way of doing this? Do I have to do it “manually” like this?
i = 0
new_list = []
for item in a:
if item != b[i]:
new_row.append(item)
else:
new_row.append('')
i += 1
new_list.append(new_row)
I don’t think there’s a builtin, but here’s a shorter “manual” way: