python 判断是否空字符串

方法1:

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

 

方法2:

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

 

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