![](/img/trans.png)
[英]How do I get compiled python(with cxFreeze) to get the current working directory as the directory where the executable is in?
[英]How do I get FTP's current working directory using python
如何使用python获取FTP的当前工作目录?
我有以下代码,并希望将文件名存储到根目录中的列表中。
from ftplib import FTP
ftp = FTP('domainname.com')
ftp.login(user='username',passwd = 'password')
您可以使用ftp.pwd
获取当前的工作目录。
例如:
from ftplib import FTP
ftp = FTP('domainname.com')
ftp.login(user='username',passwd = 'password')
ftp.pwd() #Current working dir
ftp.cwd("Destination_Path") #To change to a different path
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.