Connect to FTP using Python

Guca

Active Member
Joined
Jun 1, 2015
Messages
73
Hi All

I hope everyone is well.

I am trying to create a small script to connect to FTP using python I am new to python and I was hoping to get help.

Basically the script needs to ask for the server address, username and password.

Code:
from ftplib import FTP

server= raw_input('Enter Server Address:')
user= raw_input ('Enter Username:')
word= raw_input ('Enter Password:')
ftp.login()
ftp.retrlines('LIST')

The below code works but I wanted to ask each time for the details.

Code:
from ftplib import FTP

ftp=FTP('server')
ftp.login('user','password')
ftp.retrlines ('LIST')

Thank you in advanced :)
 

sn3rd

Expert Member
Joined
Jan 18, 2008
Messages
4,305
This looks suspiciously familiar, like a university practical I once did...
 
Top