摘要: #字符串反转"""#字符串自带函数方法s="123456"print(s[:])list1=s[::-1]print(",".join(list1))"""#函数递归方法def rvs(s): if s=="": return s else: return rvs(s[1:])+s[0]#s="12 阅读全文
posted @ 2019-07-24 22:11 板岩 阅读(402) 评论(0) 推荐(0) 编辑
摘要: python字符串与列表的相互转换 学习内容: 1.字符串转列表 2.列表转字符串 1. 字符串转列表 str1 = "hi hello world" print(str1.split(" "))输出:['hi', 'hello', 'world'] 2. 列表转字符串 l = ["hi","hel 阅读全文
posted @ 2019-07-24 11:02 板岩 阅读(246) 评论(0) 推荐(0) 编辑