Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40580

Re: Input wont work with if statement if it has a space

Newsgroups comp.lang.python
Date 2013-03-05 15:33 -0800
References <f19881f0-8f12-42eb-a55a-49b858c9b50f@googlegroups.com>
Message-ID <dbf70d62-0425-43c2-ab11-37dfdcccb458@googlegroups.com> (permalink)
Subject Re: Input wont work with if statement if it has a space
From eli m <techgeek201@gmail.com>

Show all headers | View raw


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:
> 
>    raw_input("Type in a function:")
> 
>    if function == "Example":
> 
>       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:")

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Input wont work with if statement if it has a space eli m <techgeek201@gmail.com> - 2013-03-05 15:31 -0800
  Re: Input wont work with if statement if it has a space eli m <techgeek201@gmail.com> - 2013-03-05 15:33 -0800
    Re: Input wont work with if statement if it has a space emile <emile@fenx.com> - 2013-03-05 15:47 -0800
      Re: Input wont work with if statement if it has a space eli m <techgeek201@gmail.com> - 2013-03-05 17:50 -0800
      Re: Input wont work with if statement if it has a space eli m <techgeek201@gmail.com> - 2013-03-05 17:50 -0800

csiph-web