What’s the logic behind the
if condition in the below code?
My understanding :
Line 5 : path.exists()- Returns
Line 5 : not path.exists()- Returns
Line 5 : if not path.exists()- Isn’t it the same as
if not path.exists()is
False- How would the next line of code
Also, can we use the code
path.mkdir(exist_ok=True) instead of
if not path.exists(): path.mkdir()
What is the difference between the 2 codes?
Line 11 : results=search_images_ddg(...)- In this code - we are not specifying the path to the individual directories of the 3 Categories of bears
(grizzly,black,teddy). Then how are the images fetched & stored in the respective folders??
Can anyone please help me understand all the above??
Another issue with the above code :
This code is not working most of the time i.e. It is returning
0 images most of the times which can be confirmed using the below code :
fns = get_image_files(path)
fns returns this :
Only once did the code work fine returning
This behavior is seen when I am trying the code in the
Jarvis Labs console.
However, when I try the same code in
Jupyter Lab locally its working fine & returning ample images.
Could anyone please guide me the reason behind the variation in results of the same code in different scenarios!!
Thanx in advance!!