How to determine NoneTpye in python

How to determine NoneTpye in python

Recently used python-opencv to parse multiple video files, and parsed to the last frame of the first video, and an error occurredNoneTpye Report an error
In order To continue the loop, you need to determine whether the parsed image is NoneType.

Tried several methods

# 第一种方法
img == None

The expression is True when img is empty. But when img parses the image, an array is returned with the same size as img.
Insert image description here

correct way to write

img is None

Just use is None to determine NoneType. When img is not empty, returns False. When img is empty, returns True.

Guess you like

Origin blog.csdn.net/qq_32608527/article/details/130250621