Thank you for your help man!
As I said before, I not really good with python, it is a very convoluted language.
I'm just trying to understand how to break out of a loop if an "if" statement is true.
"break" does not really break anything for some reason.
I made changes to my code, added lines as you suggested and it works now!
I do not understand why it started working but it does.
I really appreciate your help man!
Here is the final version of the snippet:
As I said before, I not really good with python, it is a very convoluted language.
I'm just trying to understand how to break out of a loop if an "if" statement is true.
"break" does not really break anything for some reason.
I made changes to my code, added lines as you suggested and it works now!
I do not understand why it started working but it does.
I really appreciate your help man!
Here is the final version of the snippet:
processed_zip_file = False for ls in time_sorted_lst : ls=ls.strip() #print ("______________ ",ls) try : with ZipFile (ls, 'r') as zip_file : file_name_list = zip_file.namelist () for file_name in file_name_list : if 'Debug_' in file_name : ## Looking for a specific file Name ## print ("IN ZIP -->> ",ls) ls_p = ls.split('\\') dst = ndir_p+ls_p[-1] ## Creating a destination directory string ## print ("ZIP Namae ---------->> ", ls_p[-1]) print ("Destination String -->> ",dst) shutil.copy(ls,dst) processed_zip_file = True break if processed_zip_file: break except OSError as er : print ("ERROR Opening ZIP file ",file_name) continue