Python 条件判断的缩写方法
时间:2021-04-20 16:06:20
return (1==1) ? "is easy" : "my god" //C#中的用法
其实,在Python中,是这样写的:
print (1==2) and 'Fool' or 'Not bad'
输出结果:
Not bad
标签:Python,条件判断,缩写
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Js中的函数直接量
2007-12-21 19:15:00
Pytorch转onnx、torchscript方式
2022-05-03 11:10:43
![](https://img.aspxhome.com/file/2023/8/107248_0s.jpg)
python调试工具Birdseye的使用教程
2023-08-22 19:18:48
![](https://img.aspxhome.com/file/2023/4/93714_0s.gif)
python实现百度关键词排名查询
2023-01-19 12:26:58
SQL查询入门(中篇)
2011-09-30 11:15:09
python提取字典key列表的方法
2023-02-01 23:35:28
Python练习-承压计算
2022-04-19 15:52:21
浅谈Python之Django(三)
2021-07-07 00:38:25
![](https://img.aspxhome.com/file/2023/3/77743_0s.png)
python禁用键鼠与提权代码实例
2022-12-11 11:54:59
Flask框架工厂函数用法实例分析
2023-03-08 08:14:30
Django REST framework 如何实现内置访问频率控制
2023-08-01 17:11:00
一次python-flask蓝图的踩坑记录
2021-11-04 13:32:35
python 文件操作删除某行的实例
2022-09-21 12:15:18
Python Flask框架实现Proteus仿真Arduino与网页数据交互
2022-01-18 08:43:16
![](https://img.aspxhome.com/file/2023/0/89080_0s.png)
解析SQL Server 2005 溢用之:合并列值
2009-01-23 14:08:00
Python如何把十进制数转换成ip地址
2023-02-20 21:36:55
PHP中Too few arguments to function的问题及解决
2023-06-04 21:15:55
![](https://img.aspxhome.com/file/2023/3/55303_0s.png)
Python创建对称矩阵的方法示例【基于numpy模块】
2021-01-03 07:35:59
![](https://img.aspxhome.com/file/2023/6/96956_0s.jpg)
python图形界面教程Tkinter详解
2021-01-08 04:27:47
tensorflow实现逻辑回归模型
2022-01-18 20:10:28