比较运算符:大于
if ( a > b ):
print ("a 大于 b")
else:
print ("a 小于等于 b")
Shell命令:重定向
python test.py > test.log
将输出以
覆盖
的方式重定向到 test.log
按位运算符:按位右移
a = 0b10101 # 21
print(a >> 1)
# 结果:10
Shell命令:重定向
python test.py >> test.log
将输出以
追加
的方式重定向到 test.log
按位运算符:按位与
a = 0b10101 # 21
b = 0b01011 # 11
print(a & b)
# 结果:1
Shell命令:同时执行命令
command1 & command2 & command3
三个命令同时执行
Shell命令:只有前面命令执行成功,后面命令才继续执行
command1 && command2