如何将函数应用于变量输入列表?例如,filter函数返回true值,但不返回函数的实际输出.
from string import upper
mylis=['this is test', 'another test']
filter(upper, mylis)
['this is test', 'another test']
Run Code Online (Sandbox Code Playgroud)
预期的产出是:
['THIS IS TEST', 'ANOTHER TEST']
Run Code Online (Sandbox Code Playgroud)
我知道upper是内置的.这只是一个例子.