I have come across code in image processing where the following statement is used:
#args is a dictionary
if not args.get("video",False)
The get() method returns:
the value for the specified key if key is in dictionary.
None if the key is not found and value is not specified.
value if the key is not found and value is specified.
But the dictionary has a key "video" which is the path to a video file, and it is used later in this way:
if args.get("video")
So args.get("video") would give the path to a file. My question is, is this valid syntax for 'if' or am I missing something?
Aucun commentaire:
Enregistrer un commentaire