I have a function (below) which uses a unicode function but I receive an "NameError: name 'unicode' is not defined" which leads me to believe I need to import unicode so I tried:
pip install unicode
then:
from unicode import unicode
and I get an error:
ModuleNotFoundError: No module named 'unicode'
The code that calls the unicode function is:
def makelist(table):
result = []
allrows = table.findAll('tr')
for row in allrows:
result.append([])
allcols = row.findAll('td')
for col in allcols:
thestrings = [unicode(s) for s in col.findAll(text=True)]
thetext = ''.join(thestrings)
result[-1].append(thetext)
return result
What am I doing incorrectly?