jeudi 3 novembre 2016

HOW TO COMPARE THESE OBJECTS IN PYTHON

import urllib2

page =urllib2.urlopen(url)

data = str(page.read())

data2 = str(page.read())

if data == data2: 
    print "yes"

Hi, given the above code written in Python I can't figure out why the compare between data and data2

if data == data2: 
    print "yes"

evaluates as 'not equal' and doesn't print "yes". If some Python experts can help me out understand I'd really appreciate it.

Thank you, kind regards

Aucun commentaire:

Enregistrer un commentaire