问题描述
我想通过 python 代码在 pastebin
帖子上搜索某个单词,但是当我尝试下面的代码时它不起作用,因为代码是通过逐个字符而不是逐行检查来工作的。
这是我的代码:
import requests
import re
url = 'https://pastebin.com/raw/HtW8rYnj'
rec = requests.get(url)
a= rec.text
string_chk = 'a2235'
for line in a:
line = line.rstrip()
if re.search(r"\b{}\b".format(string_chk),line):
print('found')
else:
print('not found')
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)