If you like one liner, try:
d=eval('{'+re.sub('\'[\s]*?\'','\':\'',re.sub(r'([^'+input('SEP: ')+',]+)','\''+r'\1'+'\'',open(input('FILE: ')).read().rstrip('\n').replace('\n',',')))+'}')
Input FILE = file path, SEP = key separator character
Not the most elegant or effective way to do this, but nonetheless quite interesting :)
srami Jan 22 '14 at 10:16 2014-01-22 10:16
source share