如下所示:
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实现创建新列表和新字典,并使元素及键值对全部变成小写就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。