Danny
Danny

Reputation: 69

Reading a URLLIB response

The response I get will either be t or f. No html tags or anything just t or f.

print("'" + str(response.read()) + "'")
resp = response.read()
if "t" in resp:
        print("true")
if "f" in resp:
        print("false")

No matter what I'm not getting either true or false. Example output: 'f' no true or false. What am I doing wrong?

Upvotes: 0

Views: 125

Answers (1)

Danny
Danny

Reputation: 69

You need to store a response's read()ing in a variable because you can only read it once. – Navith 5 mins ago Thanks solved it!

Upvotes: 1

Related Questions