【发布时间】:2020-01-18 20:33:45
【问题描述】:
如何通过缩短每一行来使我的 python 代码更漂亮?例如:我有一个很长的 if 语句,我想缩短 => 将它的长度分成几行:
if (imgA.shape[0] != imgB.shape[0]) and (imgA.shape[1] != imgB.shape[1]) and (imgA.shape[2] != imgB.shape[2]):
我想要这样的东西:
if (imgA.shape[0] != imgB.shape[0]) and
(imgA.shape[1] != imgB.shape[1]) and
(imgA.shape[2] != imgB.shape[2]):
但是我得到一个语法错误。有人吗?
【问题讨论】: