From 0ec675e55bf66732323d25e51b584d7bbbf25a54 Mon Sep 17 00:00:00 2001 From: minoplhy Date: Sat, 14 Aug 2021 17:44:00 +0700 Subject: [PATCH] Remove file prompt for safety reasons --- excluder.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/excluder.py b/excluder.py index 963625f..dba2860 100644 --- a/excluder.py +++ b/excluder.py @@ -34,7 +34,11 @@ def add_file(incoming,excluded_in): with open(incoming, 'w') as f: f.writelines(set(lines)) crawler.sort(incoming) - os.remove(excluded_in) + asap = input("Do You wish to Delete Input File (Y/N) \n") + if asap == 'Y' or asap == 'y': + os.remove(excluded_in) + else: + pass def remove(incoming,userinput): with open(incoming, 'r') as f: @@ -69,7 +73,11 @@ def remove_file(incoming ,removed_in): f.write(line.replace(line ,'')) elif not line.startswith((tuple(stallin))): f.write('\n'.join([line + '\n'])) - os.remove(removed_in) + asap = input("Do You wish to Delete Input File (Y/N) \n") + if asap == 'Y' or asap == 'y': + os.remove(removed_in) + else: + pass def search(incoming,userinput): with open(incoming, 'r') as f: