The difference_update() method gets the difference of two sets.
Example
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
A = {1,4,5,6,11,13,14}
B={1,5,6,7,9,11,12}
print(A)
print(B)
print(A.difference_update(B))
print(A)
print(B)
Output:
{1, 4, 5, 6, 11, 13, 14}
{1, 5, 6, 7, 9, 11, 12}
None
{4, 13, 14}
{1, 5, 6, 7, 9, 11, 12}
Syntax
set_x.difference_update(set_y)
Parameters
set_x–one set
set_y–another set
Return Value
It doesn’t return any value.