UnitBus

search udim

Feb 15th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. import re
  2. from glob import glob
  3. from pprint import pprint
  4. filePaths = []
  5. regex  = re.compile(r'(?P<prefix>.*)<udim>(?P<suffix>.*)', re.IGNORECASE)
  6. search = re.search(regex, r"C:\filepath\filename.<UDIM>.tif")
  7. if search:
  8.     searchPath = search.group('prefix') + r'*' + search.group('suffix')
  9.     filePaths = glob(searchPath)
  10. print pprint(filePaths)
Add Comment
Please, Sign In to add comment