Python continues executing the loop during the conditions, what to do?

import websockets

from websocket import create_connection
ws = create_connection("---")
print (ws.recv())
while True:
 if json.loads(ws.recv())['event'] == 'now':
print(json.loads(json.loads(ws.recv())['data'])
input('Press enter to exit')


During script execution, instead of giving opredelennoe data under the condition that he gives (probably) the next element that comes immediately after it. How to solve this?
March 23rd 20 at 18:58
0 answer

Find more questions by tags Python