Check URL --> Simply?

Alex new_name at mit.edu
Tue Aug 14 23:54:40 EDT 2001


import urllib

def checkURL(url):
    try: urllib.urlopen(url)
    except IOError: return 0
    return 1

if __name__ == '__main__':
    assert checkURL('http://slashdot.org')
    assert not checkURL('http://foo')
    
HTH.
Alex.



More information about the Python-list mailing list