Search code examples
jsonpython-3.xraspberry-pi3raspbianpubnub

when I read message I am getting extra info. How to avoid that


I am able to read message from Pub nub but I only want "Yes" or "No". I am getting {u'text':'Yes'} and {u'text':'No'}. How to avoid extra things?

Here is my code:

while True:                                             
    result = my_listener.wait_for_message_on(channel)      
    print(result.message) 

Solution

  • while True:                                             
        result = my_listener.wait_for_message_on(channel)      
        print(result.message.get('text'))