擅长:python、mysql、java
<p>我正在尝试学习python,并且正在制作一个输出脚本的程序。我想使用os.path.join,但我很困惑</p>
<p>join('c:','sourcedir')</p>
<p>当我使用copytree命令时,Python将以所需的方式输出它,例如:</p>
<p>进口舒蒂尔</p>
<p>src=os.path.join('c:','src')</p>
<p>dst=os.path.join('c:','dst')</p>
<p>shutil.copytree(src,dst)</p>
<p>Windows对每个驱动器都有一个当前目录的概念。因此,“c:sourcedir”在当前c:directory中的意思是“sourcedir”,您需要指定一个绝对目录</p>
<p>其中任何一个都可以工作,并给出相同的结果,但我目前没有启动Windows VM来进行双重检查:</p>
<p>“c:/sourcedir”</p>
<p>join(“/”,“c:”,“sourcedir”)</p>
<p>join(“c:/”,“sourcedir”)</p>