马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
>>> heros = ["蜘蛛侠", "绿巨人", "黑寡妇", "鹰眼", "灭霸", "雷神"]
>>> heros[4]
'灭霸'
>>> heros[3:] = ["武松", "林冲", "李逵"]
>>> heros
['蜘蛛侠', '绿巨人', '黑寡妇', '武松', '林冲', '李逵']
>>> nums = [3, 1, 9, 6, 8, 3, 5, 3]
>>> nums.sort()
>>> nums
[1, 3, 3, 3, 5, 6, 8, 9]
>>> nums.reverse()
>>> nums
[9, 8, 6, 5, 3, 3, 3, 1]
>>> nums = [3, 1, 9, 6, 8, 3, 5, 3]
>>> nums.sort(reverse=True)
>>> nums
[9, 8, 6, 5, 3, 3, 3, 1]
>>> nums.count(3)
3
>>> heros.index("绿巨人")
1
>>> nums.index(3, 1, 7)
4
>>> nums_copy1 = nums.copy()
>>> nums_copy1
[9, 8, 6, 5, 3, 3, 3, 1]
>>> nums_copy2 = nums[:]
>>> nums_copy2
[9, 8, 6, 5, 3, 3, 3, 1] |