String comparison
Terry Reedy
tjreedy at udel.edu
Wed Aug 21 21:50:03 EDT 2002
> postReply = urllib.urlopen("http://css.kwe.com/web.forte",
postdata).read()
> print postReply
If this works, postReply *is* a string
> f = open("D:\PythonServerMonitor\KWE1144589.dat","r")
Either change '\' to '/' (works fine on windows) or prepend 'r' to
filename,
as in r"D:......"
> controlData = f.read()
> f.close()
If this works, controlData *also* is a string. Try
print controlData
> if (str(postReply) == str(controlData)): #Here is the
problem.
Python is not C. You just need
if postReply == controlData:
> I've also tried...
> if (strcmp(postReply, controlData) == 0):
strcmp() is C, not Python, so this should give NameError
Terry J. Reedy
More information about the Python-list
mailing list