方法一 使用中间变量
>>> a = 5
>>> b = 6
>>> temp = a
>>> a = b
>>> b = temp
>>> a
6
>>> b
5
方法二 简便的交换方式
>>> a = 5
>>> b = 6
>>> a, b = b, a
>>> a
6
>>> b
5
>>> a = 5
>>> b = 6
>>> temp = a
>>> a = b
>>> b = temp
>>> a
6
>>> b
5
>>> a = 5
>>> b = 6
>>> a, b = b, a
>>> a
6
>>> b
5