您好,我需要一些帮助来创建字符串,这些字符串将抓取包含提及 Yeezy + Footpatrol 的推文。
因此,如果提到 Footpatrol,它只会选择 Yeezy。
我不想专门写可变字符串例如:
t = ['Hello world!',
'Hello World!',
'Hello World!!!',
'Hello world!!!',
'Hello, world!',
'Hello, World!']
我只想在同一行文本中同时提到 footpatrol 和 Yeezy 时使用嵌套 for 循环推送转发。
最佳答案
使用 in
关键字:
if 'footpatrol' in line and 'Yeezy' in line:
# Do your stuff
# Pass
关于python - 如何在 Python 中使用字符串搜索关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57693137/