Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用带有以下行的 pyCurl 来调用带有连接数据的函数:
conn.setopt(pycurl.WRITEFUNCTION, on_receive)
无论如何我可以将更多参数传递给on_receive函数,例如:
on_receive
conn.setopt(pycurl.WRITEFUNCTION, on_receive, parameter_1, parameter_2)
谢谢,
乔尔
我知道的唯一直接的方法是有一个单独的跳板函数来调用带有附加参数的实际函数。换句话说,如果参数可以保持不变,则为 lambda 函数或函数指针。
connn.setopt(pycurl.WRITEFUNCTION, lambda data: real_impl(data, param1, param2))