Do a line.strip()
before making the head
call. There is a possibility that the carriage return and/or line feed characters are part of the line you just read.
Like this:
for line in f:
r = requests.head(line.strip())
print r.status_code