0

I have a script that is pulling data from a file down from an ftp site using ftplib:

ftp.retrlines('RETR '+weatherfile,callback=handleData)

So I want to define handleData to deal with the data coming down, but I would like to be able to pass in additional args to that function. So far, I haven't been able to figure out how to do this. The callback function is meant to take a single arg. Is there a way to get it to handle more than 1, or is there a reason that I should avoid trying to do it this way?

1 Answer 1

1

How about using lambda?

ftp.retrlines('RETR ' + weatherfile,
              callback=lambda line: handleData(line, other_arg, another_arg))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.