BrightXiong 发表于 2023-2-28 22:04:28

列表-切片

>>> rhyme =
>>> print(rhyme)

>>> for each in rhyme:
...         print(each)
...
1
2
3
4
5
上山打老虎
>>> rhyme
1
>>> rhyme
'上山打老虎'
>>> rhyme[-1]
'上山打老虎'
>>> rhyme

>>> rhyme

>>> rhyme[:3]

>>> rhyme

>>> rhyme[:]

>>> rhyme

>>> rhyme[::2]

>>> rhyme[::-2]
['上山打老虎', 4, 2]
>>> rhyme[::-1]
['上山打老虎', 5, 4, 3, 2, 1]
页: [1]
查看完整版本: 列表-切片