电源变换适用于非独立源码_适用于非None测试的Python程序
電源變換適用于非獨立源碼
As we have discussed in the previous post (Python None keyword), that "None" is a keyword which can be used to assign a null value to a variable or to check whether a variable contains any value or not.
正如我們在上一篇文章中討論的( Python None關鍵字 ), “ None”是可用于為變量分配空值或檢查變量是否包含任何值的關鍵字。
Example:
例:
Here, we have 3 variables a, b and c, a is being assigned with "Hello", b is being assigned with "None" and c is being assigned with 10.
在這里,我們有3個變量a , b和c , a分配給“ Hello” , b分配給“ None” , c分配給10 。
We are testing whether variables have a value or None, if they have values, we are printing their values.
我們正在測試變量是否具有值或無,如果它們具有值,我們將打印其值。
# python code for not None test# variable 1 with value a = "Hello"# variable 2 with None b = None# variable 3 with value c = 10# performing is not None test if a is not None:print("value of a: ", a) else:print("\'a\' contains None")if b is not None:print("value of b: ", b) else:print("\'b\' contains None")if c is not None:print("value of c: ", c) else:print("\'c\' contains None")Output
輸出量
value of a: Hello 'b' contains None value of c: 10翻譯自: https://www.includehelp.com/python/not-none-test.aspx
電源變換適用于非獨立源碼
總結
以上是生活随笔為你收集整理的电源变换适用于非独立源码_适用于非None测试的Python程序的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: g++默认参数_C ++默认参数| 查找
- 下一篇: 韩信大招:一致性哈希