在re.search中使用OR运算符在python 3中查找多个字符串

Hai*_*shi 0 regex search python-3.x

对不起,是否已经有人问过这个问题,尽管我找不到。我正在尝试检测网站是否使用wordpress。这是示例代码。

url = input("Please enter the URL")
if 'http://' in url:
    append = url
else:
    append = 'http://' + url
r = requests.get(append + "/robots.txt")
    response = r.text
if re.search(('/wp-includes/') | ('/wp-admin/'), response):
    print("{0} --> Its Wordpress ".format(append))
    sys.exit(0)
Run Code Online (Sandbox Code Playgroud)

它说 不能使用运算符

if re.search(('/wp-includes/') | ('/wp-admin/'), response): 
Run Code Online (Sandbox Code Playgroud)

如何搜索多个字符串,它们之间使用OR?我也尝试使用“或”并尝试了这个

if re.search('/wp-includes/' , '/wp-admin/'), response):
Run Code Online (Sandbox Code Playgroud)

谢谢

Ign*_*ams 7

正则表达式模式是单个字符串。

'(foo|bar)'
Run Code Online (Sandbox Code Playgroud)