Mac 下 Python os.listdir 出现 invalid literal for int() with base 10 错误
时间:2016-03-16 01:16:34
收藏:0
阅读:1521
因为 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
评论(0)