I have a scenario where I am trying to match below elements in json data.
a={'n_name': 'APP-Ptyh ', 'n_name': 'Com Don Ctes - Aty ', 'n_name': 'Sce Fbh - Dor Node', 'n_name': 'kke gg - Dor Node'}
b={'n_name': 'APP-Ptyh', 'n_name': 'Com Don Ctes - Aty', 'n_name': 'Sce Fbh - Dor Nomk ', 'n_name': 'kke gg - Dor Node'}
c=[]
What I have done to match :
if a["n_name"] == b["n_name"]:
c.append(b["n_name"])
This doesn't matched the elements properly as in a
data source the elements APP-Ptyh
is same in both but there is a trailing whitespace.
What is expected output is it should match irrespective of trailing white spaces.
Any help on how can I achieve that.
This is the desired output of matched elements t be stored in list c
:
c= ['APP-Ptyh', 'Com Don Ctes - Aty', 'kke gg - Dor Node']