Mac 下 Python os.listdir 出现 invalid literal for int() with base 10 错误

因为 Mac 下的 .DS_Store 也会包含进去

解决方法:

def listdirInMac(path):
    os_list = os.listdir(path)
    for item in os_list:
        if item.startswith('.') and os.path.isfile(os.path.join(path, item)):
            os_list.remove(item)
    return os_list
原文地址:https://www.cnblogs.com/yaoshi/p/5281859.html