name 'reduce' is not defined

Reason:
In Python 3, the reduce() function has been removed from the global namespace and is now placed in the fucntools module

Fix: first import and then use

from functools import reduce

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324893059&siteId=291194637