字符串或列表反转

mstr = 'abc'
ml = [1,2,3]
print(mstr[::-1])
# cba

print(ml[::-1])
#[3, 2, 1]

 

posted @ 2023-07-05 13:45  你说夕阳很美  阅读(9)  评论(0)    收藏  举报