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

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -