Created
December 5, 2020 02:37
-
-
Save shivanandmn/bf0a410358d54ab712cf729c8f45e235 to your computer and use it in GitHub Desktop.
Changing the list of PDFs files from directory by using digit-only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# changing the names of the files in a directory | |
import os | |
import re | |
path = os.getcwd() | |
k = os.listdir(path) | |
for files in k: | |
x = re.search("\d+", files) | |
if x is None: | |
continue | |
os.rename(os.path.join(path, files), | |
os.path.join(path, f"{x.group()}--interview_QAs.pdf")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment