[Tutor] cmp()

Rick Pasotto rickp@telocity.com
Wed, 14 Aug 2002 21:24:56 -0400


On Thu, Aug 15, 2002 at 01:05:58AM +0000, Kyle Babich wrote:
> On Wed, 14 Aug 2002 15:39:09 -0700 (PDT), "Danny Yoo"
> <dyoo@hkn.eecs.berkeley.edu> said:
> > >
> > > So why no matter what I enter it returns that they are equal?
> > 
> > Hi Kyle,
> > 
> > Can you explain what these two lines are doing?
> > 
> > > arg1 = stdin.readline()[-1:]
> > > arg2 = stdin.readline()[-1:]
> 
> Taking user input, removing the \n that is put at the end of it by
> default & dumping it into arg1 and arg2.

Really? :-)

Are you sure about that?

Don't you think that the following would work better?

arg1 = stdin.readline()[:-1]
arg2 = stdin.readline()[:-1]

Could it be that '\n' is always equal to '\n'?

-- 
"When people tell you we couldn't support the government on a voluntary basis,
[tell them that] we could support _a_ government, but [it] sure as hell [is]
not this one."
        --- Rob Thorn
    Rick Pasotto    rickp@telocity.com    http://www.niof.net