摘要: 1、python反转字符串 '''第一种:使用字符串切片''' s = 'Hello World' print(s[::-1]) # dlroW olleH '''第二种:使用列表的reverse方法''' l = list(s) l.reverse() print( "".join(l) ) # 阅读全文
posted @ 2020-07-06 10:18 Guohd 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 1.1 列表和元组 1、列表基本操作 1. 列表赋值 a = [1,2,3,4,5,6,7,8] a[0] = 100 #the result : [100, 2, 3, 4, 5, 6, 7, 8] 2. 元素删除 a = [1,2,3,4,5,6,7,8] del a[0] #the resul 阅读全文
posted @ 2020-07-06 09:47 Guohd 阅读(149) 评论(0) 推荐(0) 编辑