How to validate html links from CSV file?

I am very very new to python and am checking whether HTML links are active. I have a csv file with 1000 website HTML links. I can verify a single link using:

from django.core.validators import URLValidator

validate = URLValidator()

try:
    validate(www.example.com)
    print("String is a valid URL")
except ValidationError as exception:
    print("String is not valid URL")

However, I do not know enough python to do a loop of all 1000 links. I can import the csv file, but am not sure what to do next.

I have tried:

import pandas as pd
xbrllink= pd.read_csv('WEB.csv', encoding='iso-8859-1')
url = xbrllink['XBRL_LINK']

validate(url)

But I know I am missing a step. Sorry, I am just learning python. Any help would be greatly appreciated.



Read more here: https://stackoverflow.com/questions/67928340/how-to-validate-html-links-from-csv-file

Content Attribution

This content was originally published by BigSpur at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: