当前位置:主页 > 软件编程 > Python代码 >

python实现创建新列表和新字典,并使元素及键值对全部变成小写

时间:2021-01-23 10:16:50 | 栏目: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)

您可能感兴趣的文章:

相关文章