ModuleNotFoundError: No module named 'compiler'


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

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

刪除from compiler.ast import flatten

添加以下代碼:

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"],[],[[]]]))  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM