After the hint from Hans! I searched on google for those commandes and I found this link : http://docs.python.org/2/library/ftplib.html
from ftplib import FTP
ftp = FTP('ftp.hostname.com')
ftp.login('login', 'passwrd')
ftp.cwd('www') # change into 'www' directory
if 'foo' in ftp.nlst() : #check if 'foo' exist inside 'www'
print 'YES'
ftp.cwd('foo') # change into "foo" directory
ftp.retrlines('LIST') #list directory contents
else :
print 'NO'
ftp.mkd('foo') #Create a new directory called foo on the server.
ftp.cwd('foo') # change into 'foo' directory
ftp.retrlines('LIST') #list subdirectory contents
ftp.close() #close connection