SHARE
TWEET

Untitled

a guest Dec 14th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2. import re
  3.  
  4. for filename in os.listdir(os.getcwd()):
  5.     lowercase_season_regex = r"(summer|winter|spring|fall|autumn)"
  6.     season_matches = re.finditer(lowercase_season_regex, filename, re.MULTILINE | re.IGNORECASE)
  7.     for matchNum, match in enumerate(season_matches, start=1):
  8.         lowercased_season_file_name = filename.replace(match.group(), match.group().lower())
  9.         os.replace(filename, lowercased_season_file_name)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top