Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- massive=[['cn=Андрей', 'ou=Masters', 'o=lab2', '0b1dwe8065eff78ad92771ef78cc076c'],['cn=Barma', 'ou=Masters', 'o=lab2', '0b1dc48065eff78ad92771ef78cdfgdf']]
- list1=[['CN=Андрей', 'OU=Masters', 'O=lab2', '0b1dwe8065eff78ad92771ef78cc076c'],['CN=Barmad', 'OU=Masters', 'O=lab2', 'fb1dc48065eff78ad92771ef78cdfgdf']]
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- def change (massive,list1):
- to_del=[]
- to_add=[]
- for num in list1:
- if num not in massive:
- to_del.append(num)
- for num in massive:
- if num not in list1:
- to_add.append(num)
- return to_add,to_del
- to_add,to_del=change(massive,list1)
- print to_add
- print 'n'
- print to_del
- [['cn=xd0x90xd0xbdxd0xb4xd1x80xd0xb5xd0xb9', 'ou=Masters', 'o=lab2', '0b1dwe8065eff78ad92771ef78cc076c'], ['cn=Barma', 'ou=Masters', 'o=lab2', '0b1dc48065eff78ad92771ef78cdfgdf']]
- [['CN=xd0x90xd0xbdxd0xb4xd1x80xd0xb5xd0xb9', 'OU=Masters', 'O=lab2', '0b1dwe8065eff78ad92771ef78cc076c'], ['CN=Barmad', 'OU=Masters', 'O=lab2', 'fb1dc48065eff78ad92771ef78cdfgdf']]
- def change(items_1, items_2):
- # Для приведения элементов в нижний регистр
- items_1 = [list(map(str.lower, sub_list)) for sub_list in items_1]
- items_2 = [list(map(str.lower, sub_list)) for sub_list in items_2]
- to_del = [num for num in items_1 if num not in items_2]
- to_add = [num for num in items_2 if num not in items_1]
- return to_add, to_del
- items_1 = [['cn=Андрей', 'ou=Masters', 'o=lab2', '0b1dwe8065eff78ad92771ef78cc076c'], ['cn=Barma', 'ou=Masters', 'o=lab2', '0b1dc48065eff78ad92771ef78cdfgdf']]
- items_2 = [['CN=Андрей', 'OU=Masters', 'O=lab2', '0b1dwe8065eff78ad92771ef78cc076c'], ['CN=Barmad', 'OU=Masters', 'O=lab2', 'fb1dc48065eff78ad92771ef78cdfgdf']]
- to_add, to_del = change(items_1, items_2)
- print 'to_add: %s' % (to_add,)
- print 'to_del: %s' % (to_del,)
- to_add: [['cn=barmad', 'ou=masters', 'o=lab2', 'fb1dc48065eff78ad92771ef78cdfgdf']]
- to_del: [['cn=barma', 'ou=masters', 'o=lab2', '0b1dc48065eff78ad92771ef78cdfgdf']]
Add Comment
Please, Sign In to add comment