I have a problem with Python 3. I got Python 2.7 code and at the moment I am trying to update it. I get the error:
TypeError: object of type \'map\' h
In Python 3, map returns a map object not a list:
map
list
>>> L = map(str, range(10)) >>> print(L) >>> print(len(L)) Traceback (most recent call last): File "", line 1, in TypeError: object of type 'map' has no len()
You can convert it into a list then get the length from there:
>>> print(len(list(L))) 10