If a file name begins with only a disk designator but not the backslash after the colon, it is interpreted as a relative path to the current directory on the drive with the specified letter.
@oio de 链接里找到了 "C:tmp.txt" refers to a file named "tmp.txt" in the current directory on drive C. "C:tempdir\tmp.txt" refers to a file in a subdirectory to the current directory on drive C.
啊,这句话一开始没看太懂,现在好像明白了... If a file name begins with only a disk designator but not the backslash after the colon, it is interpreted as a relative path to the current directory on the drive with the specified letter. 应该是会跑到当前目录里...
系统分隔符可以使用os.sep,问题是,麻烦的很是每一个连接符都要用 Notice the use of the os.sep variable - this gives the directory separator according to your operating system i.e. it will be ’/’ in GNU/Linux and Unix, it will be ’\\’ in Windows and ’:’ in Mac OS. Using os.sep instead of these characters directly will make our program portable and work across all of these systems 某pdf的介绍 @ffts