python之倒序字符串
2015-11-20 18:58
525 查看
python:
需求:输入任意字符串,结果倒序输出该字符串!
2、列表倒序方法 reverse()方法 列表.reverse()
3、列表转字符串 join()方法 字符.join(列表)
本文出自 “开源是精神,分享是美德” 博客,请务必保留此出处http://hongtengfei.blog.51cto.com/9881650/1715184
需求:输入任意字符串,结果倒序输出该字符串!
#!/usr/bin/env python s = raw_input("Please enter a string:") alist = list(s) alist.reverse() kong = '' print kong.join(alist)用到知识点: 1、字符串转列表 list()函数
2、列表倒序方法 reverse()方法 列表.reverse()
3、列表转字符串 join()方法 字符.join(列表)
本文出自 “开源是精神,分享是美德” 博客,请务必保留此出处http://hongtengfei.blog.51cto.com/9881650/1715184
相关文章推荐
- Python 列表、元组、字典、字符串
- python或者postgresql图形化界面连接postgresql拒绝访问
- [python]pip常用命令(转载)
- FireFly开发之路(一)python学习一
- Python 练习册,每天一个小程序 -- 0000题
- numpy函数解析
- 关于升级python yum报错No module named yum
- selenium webdriver python 开始
- 机器学习之Python安装和numpy配置
- Python_XlsxWriter_简介
- python 中__name__ = '__main__' 的作用
- MySQLdb-python的安装
- python 例外与异常mac地址
- Python刷题笔记(5) - 判断“幸运数”
- The fisr scan script coded by python
- To Summarize the Error of Ipython Notebook
- Getting Started with Salt Stack-the Other Configuration Management System Built with Python
- python Queue的多线程应用
- 王亟亟的Python学习之路(七)-date,continue,迭代对象,生成器
- 王亟亟的Python学习之路(七)-date,continue,迭代对象,生成器