Pythonic way to retrieve case sensitive path?

view full story

http://stackoverflow.com – I was wondering if there was a faster way to implement a function that returns a case-sensitive path in python. One of the solutions I came up with works with both linux and windows, but requires that I iterate os.listdir, which can be slow. This solution works fine for an application and context that does not need plenty of speed: def correctPath(start, path): 'Returns a unix-type case-sensitive path, works in windows and linux' start = unicode(start); path = unicode(path); b = ''; if path[-1] == '/': path = path[:-1]; parts = path.split('\\'); d = start; (HowTos)