Last active
March 11, 2020 05:10
-
-
Save RagtagGeoduck/abacc0840bf1667d84c10622ca1aabc6 to your computer and use it in GitHub Desktop.
[Python反转list的三种方法] 对列表的内容进行倒置 #Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list(reversed(a)) #reversed(a)返回的是迭代器,所以前面加个list转换为list | |
sorted(a,reverse=True) | |
a[: :-1] #其中[::-1]代表从后向前取值,每次步进值为1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment