Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60331
| References | <a4a25260-4786-4b2b-81f5-5da87b05d301@googlegroups.com> <mailman.3102.1385245397.18130.python-list@python.org> <8445e47e-7efe-4f37-9b40-db2896d581f8@googlegroups.com> |
|---|---|
| Date | 2013-11-24 09:41 +1100 |
| Subject | Re: stuck at this from so much time,need help....please .. |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3104.1385246500.18130.python-list@python.org> (permalink) |
On Sun, Nov 24, 2013 at 9:33 AM, Bhanu Karthik <bhanukarthik2002@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
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
stuck at this from so much time,need help....please .. Bhanu Karthik <bhanukarthik2002@gmail.com> - 2013-11-23 14:15 -0800
Re: stuck at this from so much time,need help....please .. Chris Angelico <rosuav@gmail.com> - 2013-11-24 09:23 +1100
Re: stuck at this from so much time,need help....please .. Bhanu Karthik <bhanukarthik2002@gmail.com> - 2013-11-23 14:29 -0800
Re: stuck at this from so much time,need help....please .. Chris Angelico <rosuav@gmail.com> - 2013-11-24 09:32 +1100
Re: stuck at this from so much time,need help....please .. MRAB <python@mrabarnett.plus.com> - 2013-11-23 22:58 +0000
Re: stuck at this from so much time,need help....please .. Bhanu Karthik <bhanukarthik2002@gmail.com> - 2013-11-23 14:33 -0800
Re: stuck at this from so much time,need help....please .. Roy Smith <roy@panix.com> - 2013-11-23 17:37 -0500
Re: stuck at this from so much time,need help....please .. Bhanu Karthik <bhanukarthik2002@gmail.com> - 2013-11-23 14:39 -0800
Re: stuck at this from so much time,need help....please .. Chris Angelico <rosuav@gmail.com> - 2013-11-24 09:46 +1100
Re: stuck at this from so much time,need help....please .. Chris Angelico <rosuav@gmail.com> - 2013-11-24 09:41 +1100
csiph-web