Using variable in storbinary function of ftpilb module

A

Arya, Manish Kumar

Hi,

I am new to python.

I have written a simple code to upload a file via ftp to remote server

-------------
import sys
import ftplib
host=sys.argv[1]
username=sys.argv[2]
passwd=sys.argv[3]
filename=sys.argv[4]

print host,username,passwd

ftp = ftplib.FTP(host,username,passwd)
fd=open(filename,'rb')
ftp.storbinary('STOR filename',fd)
 
D

Diez B. Roggisch

Hi,

I am new to python.

I have written a simple code to upload a file via ftp to remote server

-------------
import sys
import ftplib
host=sys.argv[1]
username=sys.argv[2]
passwd=sys.argv[3]
filename=sys.argv[4]

print host,username,passwd

ftp = ftplib.FTP(host,username,passwd)
fd=open(filename,'rb')
ftp.storbinary('STOR filename',fd)

ftp.storbinary("STOR %s" % filename, fd)

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,698
Latest member
LydiaHalle

Latest Threads

Top