今天在搞数据处理的时候,遇到了一个莫名其妙的bug
本来的代码是这样的
from os.path import join, exists
from os import makedirs as mk
...
mk(path) if not exists(path) else path
...
结果活见鬼的报error,明明以前都不的,就报file exists error
然后我改成了
from os.path import join, exists
from os import makedirs as mk
...
if not exists(path):
mk(path)
...
然并卵,没有用
最后没有办法,只能使用万能的try…except了