I send some message 'hello' from client to server using this command on server
#Send some data to remote server
message = 'hello'
try :
s.send(message)
print 'data sent successfully'
except socket.error:
#Send failed
print 'Send failed'
Now on server side , I want to check whether this message is present as a key in dictionary which is created on server side.
msg=c.recvfrom(1024)
if msg in data2.keys():
print("key for this msg exists", msg)
else:
print("no such key exists",msg)
Now, the problem is it always says no such key exits. When I print the msg on server side which I have got from client.It comes out to be:
('hello', None)
I don't get it why it gives None along with hello.
because of this I am not even getting a match in dictionary. Please tell me where I am doing wrong.