I am using the following iter chain, to generate a list -
from itertools import chain
from utils import my_func // custom function written that performs a function.
a = list(chain.from_iterable((u, my_func(u)) for u in MyCustomClass.objects.all()))
I expect that a list will be generated. But then, I get the error - NameError: global name 'my_func' is not defined
What am I doing wrong?
尝试utils.func(),可能是该函数超出了当前范围
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.