Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.054 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'url:pipermail': 0.05; 'socket': 0.07; '(data': 0.16; '24,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'pressing': 0.16; 'quoted': 0.16; 'subject: ..': 0.16; 'subject:stuck': 0.16; 'wrote:': 0.18; 'properly': 0.19; 'split': 0.19; 'subject:need': 0.19; 'typing': 0.19; 'print': 0.22; 'comparing': 0.24; 'stick': 0.24; 'posts': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'ball': 0.31; 'text': 0.33; 'says': 0.33; 'url:python': 0.33; 'subject:time': 0.33; 'subject:from': 0.34; 'received:google.com': 0.35; 'google': 0.35; 'url:org': 0.36; 'wrong': 0.37; 'two': 0.37; 'problems': 0.38; 'nov': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'even': 0.60; 'read': 0.60; 'most': 0.60; "you're": 0.61; "you'll": 0.62; 'dont': 0.67; 'groups.': 0.74; 'obvious': 0.74; 'subject:,': 0.80; 'subject:this': 0.83; 'subject:much': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=t7sMby1hV4h9clEO+o4Gf/HQhu4rBmsxxU8A+4m9Ado=; b=WzPHne+Rlc0zZJkTfwf8MsoeXsYPvqycxvhY8CeoMCclzQtjVtSjhQTwjnkah+hBwV SKvypgDZ3gjIKWHnQ2HFxiLpug0fQlK4C2fwg4eW8DhuuiXcERUAS2/p0kF9XmDFRDMJ EuIDXUaNVInV+WQr7cRXMsZDaMxuCrsW2giLW6L1qeygFUe7dYXyEHphsS4NzWk28f/A 6CbHsdqlkR0vOvLvHReQt9Zs4Xlqiia+6R84kaoYhfrEC9LftYJe53W5WLEscjKYV2Is 0/RflATK9V14j6U7NnkzlxTSHPHJuLplHQefDkIn6u+OI9msW4+aawgzRxjQ+iWW2Xgy FLmA== MIME-Version: 1.0 X-Received: by 10.68.178.197 with SMTP id da5mr19194790pbc.28.1385246490232; Sat, 23 Nov 2013 14:41:30 -0800 (PST) In-Reply-To: <8445e47e-7efe-4f37-9b40-db2896d581f8@googlegroups.com> References: <8445e47e-7efe-4f37-9b40-db2896d581f8@googlegroups.com> Date: Sun, 24 Nov 2013 09:41:30 +1100 Subject: Re: stuck at this from so much time,need help....please .. From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1385246500 news.xs4all.nl 15932 [2001:888:2000:d::a6]:50623 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60331 On Sun, Nov 24, 2013 at 9:33 AM, Bhanu Karthik 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