String comparison

Mark McEahern marklists at mceahern.com
Wed Aug 21 13:00:33 EDT 2002


[David Iungerich]
> I'm new to Python.  I'm most comfortable with Java, but have done
> work in several other languages.  So far Python has proven rather
> annoying to deal with.

I'm sorry to hear that.  Minor suggestion:  Be specific about the problems
you're having.  And, starting off like the above is like walking into a
party, taking a turd in the punch bowl, and then asking, "Anybody have some
tissue?"

[snip]

> I've also tried...

but you haven't even told us exactly what's wrong.  You're getting an error?
Or what you expect to compare equals is not?

Fire up the Python interpreter and make sure you feel comfortable with
what's happening:

$ python
Python 2.2.1 (#1, Jun 25 2002, 10:55:46)
[GCC 2.95.3-5 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> s = "a"
>>> t = "b"
>>> s == t
0
>>> p = "a"
>>> s == p
1

Gee, no surprises there.  So, again, please help us help you by being more
specific about the problem you're having and try to leave your attitude at
the door.

Cheers,

// mark

-





More information about the Python-list mailing list