Suchitra.Vemuri | fdb220a | 2016-10-19 14:09:53 -0700 | [diff] [blame] | 1 | import pexpect,os |
| 2 | import time |
| 3 | import json |
| 4 | import collections |
| 5 | import sys |
| 6 | import robot |
| 7 | import os.path |
| 8 | from os.path import expanduser |
| 9 | |
| 10 | class utils(object): |
| 11 | |
| 12 | @staticmethod |
| 13 | def listToDict(alist, intListIndex): |
| 14 | dictInfo = alist[int(intListIndex)] |
| 15 | return dictInfo |
| 16 | |
| 17 | @staticmethod |
| 18 | def jsonToList(strFile, strListName): |
| 19 | data = json.loads(open(strFile).read()) |
| 20 | #print "data...",data |
| 21 | dataList = data[strListName] |
| 22 | return dataList |
| 23 | |
| 24 | #Test |
| 25 | #test = utils() |
| 26 | #data=test.jsonToList("Subscribers.json","SubscriberInfo") |
| 27 | #print test.jsonToList("Subscribers.json","SubscriberInfo") |
| 28 | #print "index 1...",test.listToDict(data,1) |
| 29 | |