+ -
当前位置:首页 → 问答吧 → os.path.exists()问题

os.path.exists()问题

时间:2011-03-29

来源:互联网

>>> import os
>>> os.path.exists('c:\1.txt')
False
>>> os.path.exists('C:\1.txt')
False

为什么会这样,C:盘根目录明明有“1.txt”文件

应该返回True的啊

作者: liaozd   发布时间: 2011-03-29

os.path.exists(r'c:\1.txt')

作者: llbgurs   发布时间: 2011-03-29