python实现创建新列表和新字典,并使元素及键值对全部变成小写
作者:心不在焉_ 时间:2023-12-30 00:24:26
如下所示:
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)
来源:https://blog.csdn.net/weixin_42382856/article/details/80568320
标签:python,列表,字典,元素,键值对
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Silverlight 3 Beta出来了
2009-03-19 13:17:00
一个asp简单购物车教程
2007-09-17 11:02:00
Python实现小数转化为百分数的格式化输出方法示例
2023-07-15 05:58:15
MySQL预编译功能详解
2024-01-27 06:50:25
![](https://img.aspxhome.com/file/2023/4/71784_0s.png)
Python实现动态二维码生成的示例代码
2022-08-03 15:45:39
![](https://img.aspxhome.com/file/2023/6/79616_0s.png)
python中for循环输出列表索引与对应的值方法
2023-05-01 16:59:24
![](https://img.aspxhome.com/file/2023/4/103654_0s.jpg)
Oracle Index 的三个问题
2010-07-26 12:53:00
python使用xlrd和xlwt读写Excel文件的实例代码
2021-08-30 08:43:55
ASP给长的标题加省略号...
2008-02-22 14:39:00
解决Win7 x64安装解压版mysql 5.7.18 winx64出现服务无法启动问题
2024-01-22 07:57:39
![](https://img.aspxhome.com/file/2023/5/117835_0s.png)
Python控制鼠标键盘代码实例
2021-07-28 11:17:30
js判断输入字符串是否为空、空格、null的方法总结
2024-04-19 09:56:56
Python 常用模块 re 使用方法详解
2021-02-23 13:10:19
mysql8创建、删除用户以及授权、消权操作详解
2024-01-13 22:46:34
![](https://img.aspxhome.com/file/2023/7/114977_0s.png)
python FTP批量下载/删除/上传实例
2022-11-21 15:27:59
![](https://img.aspxhome.com/file/2023/9/105769_0s.jpg)
ansible作为python模块库使用的方法实例
2022-07-15 08:01:02
面向对象的CSS
2009-07-03 12:23:00
python3 使用ssh隧道连接mysql的操作
2023-09-01 19:15:11
asp如何从数据库中删除废旧的电子信箱地址?
2009-11-15 20:04:00
Oracle自定义脱敏函数的代码详解
2024-01-26 17:33:46