filtered=[]
text="any.pdf"
if "doc" and "pdf" and "xls" and "jpg" not in text:
filtered.append(text)
print(filtered)
Run Code Online (Sandbox Code Playgroud)
这是我在Stack Overflow中的第一篇文章,所以如果在Question中有一些令人讨厌的东西,那么如果文本不包含任何这些单词,则代码会假设附加文本:doc,pdf,xls,jpg.它的工作正常如果它像:
if "doc" in text:
elif "jpg" in text:
elif "pdf" in text:
elif "xls" in text:
else:
filtered.append(text)
Run Code Online (Sandbox Code Playgroud) def func1(arg1,arg2,arg3,arg4)
...
def func2(arg5,arg6)
return a,b,c,d
func1(func2(arg5,arg6))
Run Code Online (Sandbox Code Playgroud)
我可以像这样调用func1(func2(arg5,arg6))吗?因为func2将返回4个将传递给func1的项目