我在用Python3和ftplib。在
我需要检查ftp服务器上是否存在目录。(如果没有,我可以创建它,而不是cwd到它,如果它已经存在,我将直接cwd到它中)。在
我在这里看到了Marek Marecki的方法:How to make Python check if ftp directory exists?
if 'foo' in [name for name, data in list(remote.mlsd())]:
这样的问题也会在名为“foo”的文件上触发。在
有没有一种python方法来实现这一点(显式地使用mlsd())?nlst()已弃用
非常感谢!在
也要感谢@arnial
我有以下建议:(mlsd或nslt)
我没有任何服务器支持MLSD命令,所以我不确定如何使用MLSD来实现这一点。 但是即使没有MLSD的支持,这个代码也应该可以工作。在
相关问题 更多 >
编程相关推荐