test = "Hello World"
如何反转字符?
python的作法:
>>> test = "Hello World"
>>> test[::-1]
'dlroW olleH'
digits="01235456789"
取出偶数:
>>> digits[::2]
'02468'
取出奇数:
>>> digits[1::2]
'13579'
反转串:
>>> digits[::-1]
'9876543210'
好方便!
test = "Hello World"
如何反转字符?
python的作法:
>>> test = "Hello World"
>>> test[::-1]
'dlroW olleH'
digits="01235456789"
取出偶数:
>>> digits[::2]
'02468'
取出奇数:
>>> digits[1::2]
'13579'
反转串:
>>> digits[::-1]
'9876543210'
好方便!