摘要: #列表的相关操作,列表是可变的可迭代对象 # index(value,[start,[stop]])通过值value,从指定区间查找,匹配第一个就立即返回索引,找不到,抛出ValueError lst = ['a',1,2,3,4,'a','b','c'] lst[1]='b' print(lst) 阅读全文
posted @ 2021-01-21 10:06 静惜 阅读(73) 评论(0) 推荐(0)
摘要: # 字符串格式化 format函数 # 通过位置参数,按照位置顺序替换前面的{}占位符 s1 = "name:{}, socre:{}".format("tom",89) # 关键字参数或命名参数 s2 = "name:{0},socre:{score} ".format("tom",score=9 阅读全文
posted @ 2021-01-21 09:13 静惜 阅读(179) 评论(0) 推荐(0)