方法1:

In [19]: a,b = 8,10

In [20]: a,b = b,a

In [21]: a
Out[21]: 10

In [22]: b
Out[22]: 8

方法2:

In [23]: a,b = 8,10

In [24]: a
Out[24]: 8

In [25]: b
Out[25]: 10

In [26]: a = a + b

In [27]: b = a - b

In [28]: a = a - b

In [29]: a
Out[29]: 10

In [30]: b
Out[30]: 8