I'm new to Python, and I am having some trouble splitting this string by the comma, then splitting it by the equal sign, reversing it, and print only the second value of each list within a list.
String to break up
text = "cn=username,ou=group1,ou=group2,dc=domain1,dc=enterprise"
End result
username/group1/group2/domain1/enterprise
Somethings I have tried
text = "cn=username,ou=group1,ou=group1,dc=domain1,dc=enterprise"
list_of_list = list(l.split('=') for l in (text.split(',')) )
print(text)
print(list_of_list)
output = ""
for i in list_of_list:
output += i[1] + '/'
print(output)
The result is:
username/group1/group1/domain1/enterprise/
I would like to use ('/'.join()), but I do not know how to only get the second element of the inner list.