Skip to content

Instantly share code, notes, and snippets.


merrillcook0/ Secret

Last active Nov 12, 2020
What would you like to do?
def _get_valid_attrs(item):
key_attrs = {'class', 'style'}
attrs = {
k: v if v != [] else '' for k, v in item.attrs.items() if k in key_attrs
for attr in key_attrs:
if attr not in attrs:
attrs[attr] = ''
return attrs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment