I'm working on a little script that downloads a csv file from a ftp server, and when downloaded i want to do some calulations on each row before i write it to a new file.
i have the ftp part working, but i cant figure out how to use the BytesIO data as csv data.
Im using the code below but that prints 0 rows.
Any help or push in the right direction would be very appreciated.
from ftplib import FTP
import io
ftp = FTP(FTP_SERVER)
ftp.login(FTP_USER, FTP_PASSWORD)
csv_data = io.BytesIO()
ftp.retrbinary('RETR ' + FTP_FILE, csv_data.write)
csv_reader = csv.reader(csv_data, delimiter=",")
for row in csv_reader:
print(row)