Python 为什么os.path.isbs()会给出错误的输出?

Python 为什么os.path.isbs()会给出错误的输出?,python,path,Python,Path,此源代码返回True 为什么呢 c://\\\xmls\\hello.txt怎么可能是有效路径?来自文档: 换句话说,即使这个代码也会打印True os.path.isbas(“/hello world”) 因为它以一个/开头,看起来像isbs()只检查它是否为绝对路径,而不检查它是否为有效路径?为了将来的参考,请在这里发帖提问。在这种情况下,您想要知道的与类或classmethods无关,因此所有不相关的内容都可以而且应该被消除。 print(str(os.path.isabs("

此源代码返回
True

为什么呢

c://\\\xmls\\hello.txt
怎么可能是有效路径?

来自文档:

换句话说,即使这个代码也会打印
True

os.path.isbas(“/hello world”)

因为它以一个
/

开头,看起来像
isbs()
只检查它是否为绝对路径,而不检查它是否为有效路径?为了将来的参考,请在这里发帖提问。在这种情况下,您想要知道的与类或
classmethod
s无关,因此所有不相关的内容都可以而且应该被消除。
print(str(os.path.isabs("c:///\\\\xmls\\hello.txt")))
Return True if path is an absolute pathname. 
On Unix, that means it begins with a slash, 
on Windows that it begins with a (back)slash after chopping off a potential drive letter.