Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.straub-nv.de!nuzba.szn.dk!pnx.dk!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'clause': 0.07; 'try:': 0.07; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'guys,': 0.16; 'included)': 0.16; 'statement.': 0.16; 'world!")': 0.16; 'wrote:': 0.17; 'input': 0.18; 'meant': 0.21; 'cc:2**0': 0.23; 'example': 0.23; 'this:': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'question': 0.27; 'run': 0.28; 'prints': 0.29; 'function': 0.30; 'code': 0.31; 'print': 0.32; 'problem': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'except': 0.36; 'subject:with': 0.36; 'thank': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'space': 0.39; '2013': 0.84; 'subject:space': 0.84; 'eli': 0.93 X-Received: by 10.49.49.193 with SMTP id w1mr1706644qen.3.1362534632915; Tue, 05 Mar 2013 17:50:32 -0800 (PST) Newsgroups: comp.lang.python Date: Tue, 5 Mar 2013 17:50:32 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=75.62.131.238; posting-account=T0Q4ngoAAADFqe_JPINLNp5NgW2XDzan References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 75.62.131.238 MIME-Version: 1.0 Subject: Re: Input wont work with if statement if it has a space From: eli m To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org 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: , Message-ID: Lines: 82 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362534641 news.xs4all.nl 6895 [2001:888:2000:d::a6]:54471 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40592 On Tuesday, March 5, 2013 3:47:31 PM UTC-8, emile wrote: > On 03/05/2013 03:33 PM, eli m wrote: > > > On Tuesday, March 5, 2013 3:31:13 PM UTC-8, eli m wrote: > > >> Hi guys, i have a program like this: (A lot of code is not included) > > >> > > >> run = 0 > > >> > > >> while run == 0: > > >> > > >> function = raw_input("Type in a function:") > > >> > > >> if function == "Example": > > > > whenever function isn't _exactly_ "Example" the else clause executes. > > > > If you want to catch forms of example you might try: > > > > if function.strip().upper() == "EXAMPLE": > > > > Emile > > > > > > > > > > >> > > >> print ("Hello World!") > > >> > > >> else: > > >> > > >> print ("blah blah blah") > > >> > > >> > > >> > > >> The problem is that whenever i type in example with a space after it then it prints the else statement. > > >> > > >> > > >> > > >> My question is, how do i get it to except input with spaces? > > > > > > oops i meant function = raw_input("Type in a function:") > > > Thank you!