replace {} with [] in python trying to make it work with py2.6