a guest Dec 14th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import os
- import re
- for filename in os.listdir(os.getcwd()):
- lowercase_season_regex = r"(summer|winter|spring|fall|autumn)"
- season_matches = re.finditer(lowercase_season_regex, filename, re.MULTILINE | re.IGNORECASE)
- for matchNum, match in enumerate(season_matches, start=1):
- lowercased_season_file_name = filename.replace(match.group(), match.group().lower())
- os.replace(filename, lowercased_season_file_name)
RAW Paste Data