Ive done enough research to understand my logic (I believe):
I have python code to set a variable to None so that at the db level it stores the value of this variable to Null.
Logic looks like:
# when properly set to something other than `None` an example value might be: ['6.1 ', 'Medium'
thesev=cve.find("span", class_="label-warning").text
thesevcat=re.split("- ", str(thesev))
if thesevcat is None:
thesevcat=None
else:
#looking to set thesevcat='Medium' for example
thesevcat=thesevcat[1]
sometimes thesevcat is successfully parsed the value, othertimes it cant parse it, so I want to set it to None
However, I keep getting this error:
thesevcat=thesevcat[1]
IndexError: list index out of range
what is going wrong here? Thanks