Accounting for lower and uppercase in glob
python
Solution
Something like this?
>>> def foo(extension):
... return '*.' + ''.join('[%s%s]' % (e.lower(), e.upper()) for e in extension)
...
>>> foo('mov')
'*.[mM][oO][vV]'
Problem
I need to pass an extension to function, and then have that function pull all files with that extension in both lower and uppercase form. For example, if I passed `mov`, I need to function to do: ``` videos = [file for file in glob.glob(os.path.join(dir, '*.[mM][oO][vV]'))] ``` How would I accomplish the lower + upper combination above given a lowercase input?