使用python3怎么倒叙字符串

使用python3怎么倒叙字符串?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。

#!/usr/bin/env python3.4
# -*- coding: utf-8 -*-

#某一段文字
data = "You don't need us to tell you that China's Internet space is booming. With the world's largest Internet user population—686 million as of January 2016—and a long way to go to reach Internet penetration levels of developed countries, China's Internet industry is growing in both scale and influence. And as more and more Chinese users come online, Baidu continues to innovate to meet their changing needs and diverse tastes. We aim to serve the needs of our users and customers with products and solutions that prioritize the user experience and reflect our corporate culture – simple and reliable."

#按照空格分割
strings = data.split()
arr = []

#打印出来
for string in strings:
  arr.append(string)

#将文本倒叙
arr.reverse()
# 按照空格将文本变为字符串
newstring = " ".join(arr)

print(newstring)

结果:

使用python3怎么倒叙字符串

看完上述内容,你们掌握使用python3怎么倒叙字符串的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注行业资讯频道,感谢各位的阅读!