字符串内单词 倒叙

# 实现b的倒叙
c=b[::-1]
print(c)
# 使用join函数连接
d=" ".join(c)
print("倒叙后显示",d)

# 方法2 使用for循环

a="today is best"
b=a.split()
print(b)

# 倒叙排序
c=b[::-1]
print(c)

list=""
for x in c:
    list=list+x+" "
print("倒叙后显示",list)

猜你喜欢

转载自www.cnblogs.com/gaoyuanyuan/p/9444193.html