python实现创建新列表和新字典,并使元素及键值对全部变成小写
程序员文章站
2022-05-25 19:37:58
如下所示:
lists = ['tom','jack','lucy','lily','jerry','anna']
dics = {'jack':'python...
如下所示:
lists = ['tom','jack','lucy','lily','jerry','anna'] dics = {'jack':'python','lucy':'java','jerry':'ruby','lily':'c#',} new_lists = [] for i in lists: new_lists.append(i.lower()) print(new_lists) new_dics = {} for i,j in dics.items(): new_dics[i.lower()] = j.lower() print(new_dics)
以上这篇python实现创建新列表和新字典,并使元素及键值对全部变成小写就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
上一篇: 职场感悟