Is there a standardized method to swap two variables in Python?

后端 未结 7 955
天涯浪人
天涯浪人 2020-11-22 00:09

In Python, I\'ve seen two variable values swapped using this syntax:

left, right = right, left

Is this considered the standard way to swap

相关标签:
7条回答
  • 2020-11-22 00:38

    That is the standard way to swap two variables, yes.

    0 讨论(0)
提交回复
热议问题