for key in list: if item[key]==‘0’:item[key]=‘ Kown’的三元写法
时间: 2024-01-04 08:02:48 浏览: 32
下面是将这段代码转换为三元写法的方式:
```python
[item.update({key: 'Kown'}) for key in list if item[key] == '0']
```
这行代码的作用是将列表中值为 '0' 的键值对的值改为 'Kown'。使用三元写法后,代码行数更少,但可读性可能会降低。
相关问题
For key in list:if item[key]==‘0’:item[key]=‘ Kown’的三元写法
下面是将这段代码转换为三元写法的方式:
```python
item[key] = ' Kown' if item[key] == '0' else item[key]
```
这行代码的作用是将列表中值为 '0' 的键值对的值改为 ' Kown'。使用三元写法后,可读性会降低,但代码行数会更少。
warning:permanently added 'rojiahao-virtualbox'(ECDSA)to the list of kown hosts
这段引用内容是一个关于使用ssh登录远程服务器的命令和操作的说明。其中提到了删除用户和软件操作的相关命令。
关于你提到的警告"warning: permanently added 'rojiahao-virtualbox' (ECDSA) to the list of known hosts",这是在使用ssh登录时的一个警告信息,意思是将 'rojiahao-virtualbox' 的主机加入已知主机列表,并存储在 known_hosts 文件中,以便下次登录时进行验证。这是为了确保你连接的是正确的主机,避免中间人攻击。你可以输入 "yes" 来确认连接。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)