Python create dictionary from ldif file

181 Views Asked by At

My_ldif loos like:

Dn: sample,dc=sample,dc=com Objectclass: top 
Objectclass: organizational 
Cn: sample 
Address: 123 
Address: 345 ..........................

And so on for multiple lines

I can get the output in dictionary with key and value but it only returns single key and value. As my ldif file has multiple objectclass and address values, how can I get multiple values assigned to a key in a dictionary?

Output should like as follows:

Myldif_dic = [ {‘dn’: ‘sample,dc=sample,dc=com’, ‘objectclass’: ‘top,organizational’ , ‘address’: ‘123’,’345’}]

Can some help on this?

0

There are 0 best solutions below