How do I open a random folder within a specified directory?

This Python script will open a random directory, it takes the working directory to randomize as an argument. You can setup a shortcut to call this as well.

#!/usr/bin/env python
#open-random.py
import os
import sys
import random
import subprocess
if __name__ == "__main__":
    if len(sys.argv) == 2:
        dirname = sys.argv[1]
        li = [f for f in os.listdir(dirname) if os.path.isdir(os.path.join(dirname, f))]
        random_dir = li[random.randint(0, len(li)) - 2]
        random_dir = os.path.join(dirname, random_dir)
        print('opening %s' % (random_dir))
        subprocess.call(['explorer.exe', random_dir])
    else:
        print('Usage: python open-random.py base-directory')

Usage: python open-random.py "c:\photos"