랭귀지/python
[python]FTP를 사용하여 파일 전송하는 법
유키공
2017. 12. 15. 10:09
FTP를 사용하여 파일 전송하는 법
from win32com.client import gencache
import ftplib # FTP 모듈 반입
session = ftplib.FTP('mysite.com','login','passord') # FTP 서버에 접속
uploadfile = open('upload.txt','rb') # 전송할 파일 열기
session.storbinary('STOR upload.txt', uploadfile) # 파일 전송
uploadfile.close() # 파일 닫기
session.quit() # FTP 세션