The filesystem on Windows usually preserves the case of filenames, but is case insensitive if you are accessing files.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | class FileSet:
    def __init__(self, *args):
        self._dict = {}
        for arg in args:
            self.add(arg)
    def __repr__(self):
        return "<FileSet %s at %x>" % (self._dict.values(), id(self))
    def add(self, file):
        self._dict[string.upper(file)] = file
    def remove(self, file):
        del self._dict[string.upper(file)]
    def contains(self, file):
        return string.upper(file) in self._dict.keys()
    def __getitem__(self, index):
        key = self._dict.keys()[index]
        return self._dict[key]
    def __len__(self):
        return len(self._dict)
    def items(self):
        return self._dict.values()
 | 
    Tags: files
  
  
      
 Download
Download Copy to clipboard
Copy to clipboard