# list subtract
role_dongyu.permissions = list(set(role_dongyu.permissions) - set(all_permission))
# list add
role_dongyu.permissions = role_dongyu.permissions + all_permission
role_dongyu.permissions = list(set(role_dongyu.permissions))
def set_approach(a,b):
return list(set(a)-set(b))
参考
https://stackoverflow.com/questions/2514961/remove-all-values-within-one-list-from-another-list