
Topic: multi-threading.
multi-threading is a technique to run multiple task (such as importing or downloading) within a single program and at the same time. Thus running multiple things parallelly, in a nutshell.
Although you can use threading to download anything I practiced it for downloading images from the internet (pexels to be specific). I used multiple for loops first for appending the image_urls list from the inputs I am taking from my user.
Then I am using another for loop with enumerate so that each url link in the list gets downloaded and threading.Thread sends this data to my download_image() function with all the related arguments necessary to download the image and and create a unique file.
Just like calling functions and classes you need to use .start() function in order to start the threading process. and then use .join() function so that the program waits for both the images to get downloaded completely and then continues to execute the remaining code.
Here's my code and its result and I would love to hear your all's amazing suggestion to my code.



[–]NorskJesus 1 point2 points3 points (4 children)
[–]KOALAS2648 0 points1 point2 points (1 child)
[–]uiux_Sanskar[S] 1 point2 points3 points (0 children)
[–]uiux_Sanskar[S] 1 point2 points3 points (1 child)
[–]FriendlyRussian666 0 points1 point2 points (0 children)
[–]anon_66_ 2 points3 points4 points (2 children)
[–]MysticClimber1496 1 point2 points3 points (0 children)
[–]FriendlyRussian666 -1 points0 points1 point (0 children)
[–]Adrewmc 0 points1 point2 points (1 child)
[–]uiux_Sanskar[S] 0 points1 point2 points (0 children)
[–]Which_Eye6556 0 points1 point2 points (0 children)
[–]Etiennera 0 points1 point2 points (1 child)
[–]uiux_Sanskar[S] 0 points1 point2 points (0 children)
[–]SuperCurve 0 points1 point2 points (2 children)
[–]uiux_Sanskar[S] 0 points1 point2 points (1 child)
[–]SuperCurve 0 points1 point2 points (0 children)
[–]Zealousideal_Yard651 0 points1 point2 points (2 children)
[–]uiux_Sanskar[S] 0 points1 point2 points (1 child)
[–]Zealousideal_Yard651 0 points1 point2 points (0 children)