I get the above runtime errors when I try to run the old python code base in python3. The code is as follows.
index = map(lambda x: x[0], self.history).index(state)
In Python 3 it mapdoes not return list, but map object- see:
map
list
map object
index = map(lambda x: x[0], [(1,2),(3,4)]) print( type(index) ) # <class 'map'>
you need to use list()
list()
index = list(map(lambda x: x[0], self.history)).index(state)
Source: https://habr.com/ru/post/1615938/More articles:(C) How to write / read from the memory address returned by mmap? - cPython - ValueError: неизвестный язык: UTF-8 - pythonПреобразование String во время без даты в Java - javaSQLite получает все данные и передает их адаптеру - androidGeodJango GeoJSON Сериализатор геометрии всегда "null" - postgisSkip Arraylist objects in another activity - javaiOS 9 how to programmatically use the "Return to" - iosHow to use generics as params? (Swift 2.0) - genericsbrew установка mysql, ошибка в шаге posinstall - mysqlгонка данных в простой спин-блокировке с использованием атомного - c++All Articles