On Sun, Nov 24, 2013 at 9:33 AM, Bhanu Karthik <bhanukarthik2...@gmail.com> wrote: > this is exact code.. > it is not even entering the if ... > I tried ( c= (data is '/quit')if c) > > when i print c ,its printing false....I dont understand what is > happening...please help..
Again, please get off Google Groups. Have a look at how your posts come out: https://mail.python.org/pipermail/python-list/2013-November/661005.html Note how your quoted text is double-spaced. This is one of the most obvious and obnoxious problems, though not the only one. You have two problems here. Firstly, comparing strings with 'is' is wrong in most cases[1], so stick with ==. And secondly, my crystal ball says that you're typing "/quit" and pressing enter, so your socket read will be "/quit\r\n" or "/quit\n". To properly handle this, you'll need to buffer and split as I was describing. ChrisA -- https://mail.python.org/mailman/listinfo/python-list