ModuleNotFoundError: No module named 'compiler'

修改別人項目的時候出現的錯誤:ModuleNotFoundError: No module named 'compiler'app

參考https://blog.csdn.net/w5688414/article/details/78489277已解決。spa

刪除from compiler.ast import flatten.net

添加如下代碼:code

import collections
def flatten(x):
    result = []
    for el in x:
        if isinstance(x, collections.Iterable) and not isinstance(el, str):
            result.extend(flatten(el))
        else:
            result.append(el)
    return result
 
print(flatten(["junk",["nested stuff"],[],[[]]]))  
相關文章
相關標籤/搜索