I have a script where and if-else condition is given, the if takes the user input and process that if a certain directory is empty and fills that certain directory and the else runs if the directory is already full.
if not any(fname.endswith('.csv') for fname in os.listdir(certain_dir)):
def process_user_input:
....code....
return something
else:
def do_process_on_the_full_directory:
....code....
return something_else
so, if the directory is empty, the first condition becomes True and the first process happens, and then I have to run the script again to have the else condition run on the directory that is now full. My question is whether there is a better way of doing that, so I do not have to run the script twice to get what I want, e.g, if there is a way to add order (first, fulfill the first condition, second after the directory is filled run the second condition).