966Combining JSON files in Python

Quick python script to combine several JSON files into one. File names are dict keys in the JSON output.

import os
import json

entries = os.listdir(os.getcwd())

animationFiles = [

output = {}

for name in animationFiles:
  with open(name + '.json') as f:
    output[name] = json.loads(f.read())

outputFile = open('output.json', 'w')
outputFile.write( json.dumps(output) )


636Python 3.1 and TextMate

http://stackoverflow.com/questions/1775954/using-python-3-1-with-textmate Variable can be set in TextMate either on a global or on a per project basis. It seems some of the internals are coded using Python 2.x, therefore a global switch to the backwards-incompatible 3.x is not recommended. Project based variable can be set by opening a project, deselecting any text files, and clicking on the little i-icon in the project window. My path for Python 3.1 is: TM_PYTHON /Library/Frameworks/Python.framework/ Versions/3.1/bin/python3 Your milage might vary.