- Learning Python for Forensics
- Preston Miller Chapin Bryce
- 119字
- 2021-08-20 10:17:02
Boolean and none
The integers 0 and 1 can also represent Boolean values in Python. These values are the Boolean False or True objects, respectively. To define a Boolean, we can use the bool() constructor statement. These data types are used extensively in program logic to evaluate statements for conditionals, as covered later in this chapter.
Another built-in data type is the null type, which is defined by the keyword None. When used, it represents an empty object, and when evaluated will return False. This is helpful when initializing a variable that may use several data types throughout execution. By assigning a null value, the variable remains sanitized until reassigned:
>>> bool(0)
False
>>> bool(1)
True
>>> None
>>>
推薦閱讀
- 攻守道:企業(yè)數(shù)字業(yè)務(wù)安全風(fēng)險(xiǎn)與防范
- Practical Network Scanning
- 網(wǎng)絡(luò)安全意識導(dǎo)論
- Mastering Kali Linux for Advanced Penetration Testing
- INSTANT Windows PowerShell
- Kali Linux Network Scanning Cookbook(Second Edition)
- Spring Security(Third Edition)
- Building a Home Security System with BeagleBone
- 數(shù)據(jù)安全領(lǐng)域指南
- Instant Java Password and Authentication Security
- Mastering Reverse Engineering
- End to End GUI Development with Qt5
- 黑客攻防實(shí)戰(zhàn)從入門到精通
- 網(wǎng)絡(luò)安全大數(shù)據(jù)分析與實(shí)戰(zhàn)
- 信息安全工程與實(shí)踐