From b00188b257ba8b696f18eb6539a31772586281c4 Mon Sep 17 00:00:00 2001 From: jancoxx412 <40721310+jancoxx412@users.noreply.github.com> Date: Sun, 3 Oct 2021 06:17:23 +0700 Subject: [PATCH 1/5] Create clean.py --- remove-duplicate/clean.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 remove-duplicate/clean.py diff --git a/remove-duplicate/clean.py b/remove-duplicate/clean.py new file mode 100644 index 000000000..4001c5e17 --- /dev/null +++ b/remove-duplicate/clean.py @@ -0,0 +1,20 @@ +import tqdm +import time +listnya = input('input list : ') +output = input('Output Destination : ') +lists = open(listnya) +cok = set(lists.readlines()) +total = len(list(open(listnya))) +print ("[+] Found Total {} List".format(str(total))) +print ("[+] Start Remove Duplicate ...\n\n") +time.sleep(1) +count = 0 +result = listnya.replace(".txt","") +file = result+'-clean.txt' +folder = str(output) +for i in tqdm.tqdm(cok): + time.sleep(0) + count +=1 + open(folder+file,'a').write(i) +final = total-count +print ("\nSuccess Remove {} From list".format(str(final))) From 6f933cab27a11a66644a6a34a2ef65606b7d7339 Mon Sep 17 00:00:00 2001 From: jancoxx412 <40721310+jancoxx412@users.noreply.github.com> Date: Sun, 3 Oct 2021 06:19:35 +0700 Subject: [PATCH 2/5] Create Readme.md --- remove-duplicate/Readme.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 remove-duplicate/Readme.md diff --git a/remove-duplicate/Readme.md b/remove-duplicate/Readme.md new file mode 100644 index 000000000..ffe85d0ac --- /dev/null +++ b/remove-duplicate/Readme.md @@ -0,0 +1,16 @@ +# Python Clean Duplicate String from file + +## Setup and activate virtual environment : +For Unix based systems please execute the following command to create venv and install requirements. +``` +make init +source .venv/bin/activate +``` + +## Running : + +``` +pip install -r requirements.txt +python clean.py +``` + From d068b2de2ac9abe9f6e38b09a48cbb0c8a595873 Mon Sep 17 00:00:00 2001 From: jancoxx412 <40721310+jancoxx412@users.noreply.github.com> Date: Sun, 3 Oct 2021 06:19:50 +0700 Subject: [PATCH 3/5] Create requirements.txt --- remove-duplicate/requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 remove-duplicate/requirements.txt diff --git a/remove-duplicate/requirements.txt b/remove-duplicate/requirements.txt new file mode 100644 index 000000000..a083eaa95 --- /dev/null +++ b/remove-duplicate/requirements.txt @@ -0,0 +1 @@ +tqdm==4.62.3 From 9751e61a1763dbc95a55384960e22989f0b51c5b Mon Sep 17 00:00:00 2001 From: jancoxx412 <40721310+jancoxx412@users.noreply.github.com> Date: Sun, 3 Oct 2021 06:28:22 +0700 Subject: [PATCH 4/5] Update clean.py --- remove-duplicate/clean.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/remove-duplicate/clean.py b/remove-duplicate/clean.py index 4001c5e17..6cff96ac8 100644 --- a/remove-duplicate/clean.py +++ b/remove-duplicate/clean.py @@ -1,20 +1,20 @@ import tqdm import time listnya = input('input list : ') -output = input('Output Destination : ') +output = input('Output Destination : ') lists = open(listnya) -cok = set(lists.readlines()) +cok = set(lists.readlines()) total = len(list(open(listnya))) -print ("[+] Found Total {} List".format(str(total))) -print ("[+] Start Remove Duplicate ...\n\n") +print("[+] Found Total {} List".format(str(total))) +print("[+] Start Remove Duplicate ...\n\n") time.sleep(1) count = 0 -result = listnya.replace(".txt","") +result = listnya.replace(".txt", "") file = result+'-clean.txt' folder = str(output) for i in tqdm.tqdm(cok): - time.sleep(0) - count +=1 - open(folder+file,'a').write(i) + time.sleep(0) + count += 1 + open(folder+file, 'a').write(i) final = total-count -print ("\nSuccess Remove {} From list".format(str(final))) +print("\nSuccess Remove {} From list".format(str(final))) From a02eb74af0fbab970c6b8d2bd59f6b63328bed61 Mon Sep 17 00:00:00 2001 From: jancoxx412 <40721310+jancoxx412@users.noreply.github.com> Date: Sun, 3 Oct 2021 06:29:44 +0700 Subject: [PATCH 5/5] Update clean.py --- remove-duplicate/clean.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remove-duplicate/clean.py b/remove-duplicate/clean.py index 6cff96ac8..88ebbfa49 100644 --- a/remove-duplicate/clean.py +++ b/remove-duplicate/clean.py @@ -10,11 +10,11 @@ time.sleep(1) count = 0 result = listnya.replace(".txt", "") -file = result+'-clean.txt' +file = result + '-clean.txt' folder = str(output) for i in tqdm.tqdm(cok): time.sleep(0) count += 1 - open(folder+file, 'a').write(i) -final = total-count + open(folder + file, 'a').write(i) +final = total - count print("\nSuccess Remove {} From list".format(str(final)))