I am getting above run time error, when I am trying to run an old python codebase into python3. The code looks like below.
index = map(lambda x: x[0], self.history).index(state)
In Python 3 map
doesn't return list
but map object
- see:
index = map(lambda x: x[0], [(1,2),(3,4)])
print( type(index) )
# <class 'map'>
you have to use list()
index = list(map(lambda x: x[0], self.history)).index(state)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With