python 判断是否空字符串

方法1:

float(inputStr.strip() or '0')

 

方法2:

"0" if inputStr=="" else "123"

 

posted @ 2021-11-25 10:49  正怒月神  阅读(153)  评论(0编辑  收藏  举报