You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
436 B

import subprocess
p1 = subprocess.Popen('ftp', shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
comandos = [b"verbose\n",
b"open test.rebex.net\n",
b"demo\n",
b"password\n",
b"ls\n",
b"get readme.txt\n"]
for cmd in comandos:
p1.stdin.write (cmd)
respuesta = p1.communicate(timeout=5)[0]
print (respuesta.decode("cp850", "ignore"))

Powered by Informatica FP.