python - Unexpected result when comparing value received from socket to integer -


i'm receiving data socket, saving 1 of elements recentnumb.

when print before if statement correctly prints it's 0. unfortunately if statement behaves if recentnumb different 0, no matter how modify expression. explain me why if statement not see recentnumb 0?

r = wrappedsocket.recv(1024) v = r.split() recentnumb = v[1]  print recentnumb  if recentnumb != 0:     dothis() else:     ordothis() 

the docs state socket.recv() "return value string representing data received", might try int(v[1]).


Comments

Popular posts from this blog

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -