Window 10家庭中文版,Python 3.6.4,

当一个路径以多个斜杠(/)或反斜杠字符(\\)结尾时,os.path.isdir(path)函数仍然将它们判断为目录:

>>> os.path.isdir('C:/Python36/Lib/sqlite3//')
True
>>> os.path.isdir('C:/Python36/Lib/sqlite3///')
True
>>> os.path.isdir('C:/Python36/Lib/sqlite3///////')
True
>>> os.path.isdir('C:\\Python36\\Lib\\sqlite3\\\\\\\\') # 8个反斜杠(转义后是4个反斜杠 )
True

孤的判断是返回False的,为何会如此?后续会继续dig~

----

Python官文信息:

os.path.isdir(path)
Return True if path is an existing directory. This follows symbolic links, so both islink() and isdir() can be true for the same path.

path-like object
An object representing a file system path. A path-like object is either a str or bytes object representing a path, or an object implementing the os.PathLike protocol. An object that supports the os.PathLike protocol can be converted to a str or bytes file system path by calling the os.fspath() function; os.fsdecode() and os.fsencode() can be used to guarantee a str or bytes result instead, respectively. Introduced by PEP 519.

class os.PathLike
An abstract base class for objects representing a file system path, e.g. pathlib.PurePath.

PEP 519 -- Adding a file system path protocol

最新文章

  1. Android图片开发内幕--基础篇
  2. 第十一篇 Integration Services:日志记录
  3. DNA repair - HDU 2457(自动机+dp)
  4. NET基础课--组件2
  5. C# 计算器 运算符和数字键的keys对照
  6. 扩展SpringMVC以支持绑定JSON格式的请求参数
  7. AI繁荣下的隐忧——Google Tensorflow安全风险剖析
  8. Linux下编译安装php7.2
  9. 从0开始用U盘制作启动盘装Windows10系统(联想R720笔记本)并永久激活方法
  10. CodeForces - 314C Sereja and Subsequences (树状数组+dp)
  11. 软件测试3gkd
  12. HTTPS SSL & TLS
  13. nginx 做数据仓库时,location 404 Not Found,发现找不到要用的数据报:Not Found
  14. 在SharePoint Server 2010中更改“我的网站”
  15. ROS知识(2)----理解ROS系统结构
  16. asp.net MVC 统计在线人数功能实现
  17. lxd&openstack-lxd源码剖析
  18. erl_0021 erlang和java的内存模型比较(引用)
  19. 解决linux下python多版本兼容问题?
  20. mongodb聚合(转)

热门文章

  1. Longest Word in Dictionary through Deleting - LeetCode
  2. 20135239益西拉姆 Linux内核分析 进程的描述和进程的创建
  3. Java ConcurrentModificationException 异常分析与解决方案
  4. 解题:APIO 2014 序列分割
  5. Centos Python3安装共存
  6. python小专题——urllib2模块
  7. Hibernate中常见问题 No row with the given identifier exists问题
  8. POI导入excel文件2
  9. linux命令总结之route命令
  10. python 生成器和迭代器介绍