Filter Object Has No Attribute Pop
colorramps = re.split('#ramp\[([0-9a-fA-F]{6})\](.+?)#rampend\[([0-9a-fA-F]{6})\]', message) colorramps.reverse() if len(colorramps) > 1: starttext = colorramps.pop() st
Solution 1:
Are you running this in Python 3?
In Python 2.7 filter()
returned a list
, which has .pop()
function.
In Python 3.x filter()
returns a filter
iterable object which does not.
Before you can .pop()
from the filter
in Python 3 you need to convert it to a list. So add e.g.
colors = list(colors)
after the colors = filter(...)
line. In Python 2.7 this will have no effect, so your code will continue to work there. See this question for more information and these docs.
Post a Comment for "Filter Object Has No Attribute Pop"