python连接服务器创建文件夹
时间: 2023-10-07 18:04:15 浏览: 107
创建文件夹
在Python中连接到FTP服务器并创建文件夹可以通过使用ftplib库实现。首先,你需要创建一个FTP对象并连接到服务器。然后,使用login函数登录到服务器。接下来,你可以使用mkd函数创建文件夹。下面是一个示例代码:
import ftplib
host = '192.168.11.50'
ftp = ftplib.FTP()
ftp.connect(host, 21001)
ftp.login('ftpuser', 'XXXXXXXXXXX')
folder_name = '新文件夹'
ftp.mkd(folder_name)
ftp.quit()
这样,你就可以连接到FTP服务器并创建一个名为"新文件夹"的文件夹。请确保替换host,登录凭据和文件夹名称为你自己的值。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [python连接FTP服务器](https://blog.csdn.net/gc_2299/article/details/123674840)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *3* [【Python基础学习】—文件和文件夹操作](https://blog.csdn.net/dream_successor/article/details/93489340)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文