https://blog.csdn.net/weixin_42445362/article/details/109819677
p = "Tom is a boy,Lucy is a girl,Tom like math and Lucy like english!" keywordslist= ["english","math","history","laws"] sum([1 if w in p and w else 0 for w in keywords.split(',')]) sum([1 if w in p and w else 0 for w in keywordslist])
输出2
标签:多个,python,sum,keywordslist,Tom,字符串,math From: https://www.cnblogs.com/Cookie-Jing/p/16997338.html