Testing which websites are live from a long list, in python

  python, readfile

I have a very long list of possible websites. These are similar to

www.a.com

www.b.com

www.c.com

www.d.com

www.e.com

…… et cetera

I have nearly half a million possible websites. These are stored in a text file, with each possible on a separate line (and no blank lines – I have had to put blank lines in this question’s example above to stop stackoverflow from merging them all into one sentence).

I would like a python program which tests each line to see if it is a live website, and saves which ones are live into a separate file/new list or something similar, so I can have a record of which ones are live. I am expecting about 50 are live, and the rest are not.

Any help appreciated – thank you.

Source: Python Questions

LEAVE A COMMENT