Untitled

 avatar
unknown
plain_text
5 months ago
937 B
5
Indexable
def printObjectNicely(obj):

 count=1

 if(type(obj)==list):
 for i in obj:
 print("\t "+ ("BLOCK_" if i.type=="BLOCK" else "ARROW_")+str(count)+" : "+ 
json.dumps(i.__dict__))
 count+=1
 else:
 print("\t "+ ("BLOCK_" if obj.type=="BLOCK" else "ARROW_")+str(count)+" : "+ 
json.dumps(obj.__dict__))
 json__string = json.dumps(obj.dict, indent=6)
 json_string_load = json.loads(json__string)
 print(json_string_load)
 if "ID" in json_string_load:
 print("ID here")
 id_string = json.dumps(json_string_load["ID"])
 print("\t "+ id_string)
 if id_string == "1":
 print("Found Dhwani")
 data = "Dhwani found"
 elif id_string == "2":
 print("Found Hetvi")
 data = "Hetvi found"
 elif id_string == "3":
 print("Found prachi")
 data = "Prachi found"
 else:
 print("not found")
 data = "no data"
 exp = { # data to be published
 data
 }
 pubnub.publish().channel(channel).message(exp).sync() # publish to channe
Editor is loading...
Leave a Comment