I have a set of folders and files that have arbitrary names. My end goal is to parse through the folders and files and create a nicely sorted and named set of folders. These titles sometimes have spaces as delimiters and sometimes have periods (I haven't found any examples with anything other than those as delimiters). I want to display these filenames without delimiters and with only the real words (specific the title of the file and a date if the date is relevant). I'm not worrying about the dates for now, I have a lookup table to figure out the dates based on the correctly spelled title.
Examples of titles:
A Bad Title (1975)
another bad title asdf.com 1975
Another Bad Title (1975)
a really.bad title
A Really Bad Title (1975)
('a', 'bad', 'title', '1975')
('a', 'really', 'bad', 'title')
2001: A Space Odyssey
Quick n' Dirty:
import re for title in [ "a.bad.title.asdf.1975", "another bad title asdf.com 1975", "a really.bad title"]: print(" ".join(map(str.title, re.findall(r"\w+", title))))
A Bad Title Asdf 1975 Another Bad Title Asdf Com 1975 A Really Bad Title 1975
In this form, it should be easy to compare against known titles.