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


Groups > comp.lang.python > #9054

Re: i get different answers based on run platform

Date 2011-07-07 19:59 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: i get different answers based on run platform
References <842fce9d-1b3f-434a-b748-a6dc4828c385@h12g2000pro.googlegroups.com> <iv4ue2$ij0$1@reader1.panix.com>
Newsgroups comp.lang.python
Message-ID <mailman.762.1310065208.1164.python-list@python.org> (permalink)

Show all headers | View raw


On 07/07/2011 19:37, John Gordon wrote:
> In<842fce9d-1b3f-434a-b748-a6dc4828c385@h12g2000pro.googlegroups.com>  linda<postslot@gmail.com>  writes:
>
>> I have this simple palindrome program that yields different results
>> depending on whether I run it from Windows or from IDLE.  The answer
>> is correct off IDLE, but why is this the case?  Here's the code:
>
> Your code contains debugging statements that print the value of the normal
> string and the reversed string.  What do those statements print when you
> run your program under Windows?  That should go a long way towards telling
> you what the problem is.
>
> (Perhaps Windows leaves a linefeed character hanging at the end of the
> input line, which upsets the palindromic balance?)
>
> By the way, I could not make your program work as you provided it; I had
> to replace input() with raw_input().  Does it really work for you this way?
>
It's Python 3.

Python 2's raw_input() has been renamed input() in Python 3 and Python
2's input() was never in Python 3 because it uses eval on the string,
which usually undesirable.

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


Thread

i get different answers based on run platform linda <postslot@gmail.com> - 2011-07-07 11:18 -0700
  Re: i get different answers based on run platform John Gordon <gordon@panix.com> - 2011-07-07 18:37 +0000
    Re: i get different answers based on run platform Ethan Furman <ethan@stoneleaf.us> - 2011-07-07 12:11 -0700
    Re: i get different answers based on run platform MRAB <python@mrabarnett.plus.com> - 2011-07-07 19:59 +0100
      Re: i get different answers based on run platform linda <postslot@gmail.com> - 2011-07-07 14:09 -0700
        Re: i get different answers based on run platform Ethan Furman <ethan@stoneleaf.us> - 2011-07-07 14:42 -0700
          Re: i get different answers based on run platform linda <postslot@gmail.com> - 2011-07-07 14:37 -0700
  Re: i get different answers based on run platform Ethan Furman <ethan@stoneleaf.us> - 2011-07-07 11:58 -0700
  Re: i get different answers based on run platform MRAB <python@mrabarnett.plus.com> - 2011-07-07 19:54 +0100

csiph-web