Python: How to pass in only one variable into a lambda function?
Python: How to pass in only one variable into a lambda function?
Lambda expressions syntax in Python is:
lambda [list of arguments]: <expression>
In your code you do not have any arguments defined for your lambdas. You need to add an argument named line
before the :
character to make your code work:
lambda line: write_csv(m, line), lambda line: write_csv(u, line)