I would like to specify the port with Python's ftplib client (instead of default port 21).
Here is the code:
from ftplib import FTP
ftp = FTP('localhost') # connect to host, default port
Is there an easy way to specify an alternative port?
I would like to specify the port with Python's ftplib client (instead of default port 21).
Here is the code:
from ftplib import FTP
ftp = FTP('localhost') # connect to host, default port
Is there an easy way to specify an alternative port?
Found the answer. Instantiate the FTP object and then run connect on it like so:
After searching numerous solutions, a combination of the docs.python.org and the
connect
command solved my issue.If you're using plain FTP instead of FTPS, just use
ftplib.FTP
instead.Yes you can use connect