From 8cc9cc9ab6e80859f0f5af3a29ecc2a655483225 Mon Sep 17 00:00:00 2001 From: ShivSt Date: Mon, 20 Jul 2020 13:45:59 +0530 Subject: [PATCH 1/2] for updating the project names as per standard --- standardize_project_name.py | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 standardize_project_name.py diff --git a/standardize_project_name.py b/standardize_project_name.py new file mode 100644 index 00000000..edd4d37c --- /dev/null +++ b/standardize_project_name.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +import os + +# Using os module to convert the file/folder's name +projects_old = os.listdir("projects") +projects_new = [] +for project in projects_old: + name_old = project.lower() + name = "" + n = 0 + for c in name_old: + if ord(c) in range(97, 123) or c == ".": + name += c + n = 1 + elif n == 1: + name += " " + n += 1 + else: + pass + + name_new = "" + for word in name.split(): + if word in [ + "write", + "create", + "script", + "a", + ]: # the list can be configured as per future requirement + pass + else: + name_new = " ".join([f"{name_new}", f"{word}"]).strip() + + if name_new.split()[0] in [ + "to", + " ", + ]: # this list will provide extra truncation at statring word of name + name_new = " ".join(name_new.split()[1:]).strip() + + projects_new.append(name_new) + +for i in range(len(projects_new)): + os.rename(f"projects/{projects_old[i]}", f"projects/{projects_new[i]}") From 03de4dac01c2b98755d5a0f9d3cce57b63856d3b Mon Sep 17 00:00:00 2001 From: Ravishankar Chavare <33047641+chavarera@users.noreply.github.com> Date: Mon, 20 Jul 2020 22:58:51 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6539696d..3b7cd8e4 100644 --- a/README.md +++ b/README.md @@ -60,3 +60,4 @@ Sr no | Project Name | Author 36 | [Compress file and folders](https://github.com/chavarera/python-mini-projects/tree/master/projects/write%20script%20to%20compress%20folder%20and%20files) | [Gaodong](https://github.com/xlgd) 37 | [Find IMDB movie ratings](https://github.com/chavarera/python-mini-projects/tree/master/projects/Find%20IMDb%20rating) | [ShivSt](https://github.com/ShivSt) 38 | [Convert dictionary to python object](https://github.com/chavarera/python-mini-projects/tree/master/projects/convert_dictionary_to_python_object) | [Varun-22](https://github.com/Varun-22) +39 | [move files to alphabetically arranged folders](https://github.com/chavarera/python-mini-projects/tree/master/projects/Write%20script%20to%20move%20files%20into%20alphabetically%20ordered%20folder) | [Chathura Nimesh](https://github.com/kana800/)