Created
August 15, 2013 15:38
-
-
Save wilwang/6241860 to your computer and use it in GitHub Desktop.
python script to look for a particular file (json), and parse, and print out what I want
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
def printJsonData(filename): | |
file = open(filename) | |
jsonString = file.read() | |
jsonString = jsonString.replace('\'', '"') | |
#print(jsonString) | |
jsonObject = json.loads(jsonString) | |
print(jsonObject['Namespace'] , '|', jsonObject['ProcPrefix']) | |
file.close() | |
dir = 'c:\\svn\\k2\\trunk\\services' | |
for root, dirs, files in os.walk(dir): | |
for filename in files: | |
if filename == "DataLayer.json": | |
filename = os.path.join(root, filename) | |
printJsonData(filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment