title: globbing a range with padded 0's- python
body: <p>Quick question regarding globbing in python.</p>
  
  <p>I have a directory of files that go 'sync_0001.tif', 'sync_0002.tif', ... , 'sync_2400.tif'. I'd like to obtain 3 subset lists of those files: 1 for the first 800 files, second 800 files, and last 800 files. The only problem is the 0's before the numbers. I can't figure out the right way to glob and obtain those lists. The third list is easy because there are no 0's padding any of those files (s3=glob.glob('sync_[1601-2400].tif'). The other two are trickier because the number of 0's out front varies.</p>
  
  <p>I tried this, but got 'bad character range,' I'm guessing because of the 0's:</p>
  
  <pre><code>s1 = glob.glob('sync_' + '{[0001-0009], [0010-0099], [0100-0800]}' + '.tif')
  s2 = glob.glob('sync_' + '{[0801-0999], [1000-1600]}' + '.tif')
  </code></pre>
  
  <p>I then tried moving the 0's out front like so, but got an empty list:</p>
  
  <pre><code>s1 = glob.glob('sync_' + '{000[1-9], 00[10-99], 0[100-800]}' + '.tif')
  </code></pre>
  
  <p>What's the best way to achieve these three lists? I'm starting to think I have the whole glob thing wrong, so if someone could shed some light that would be great. Thanks!</p>