我需要提取具体的数字和文字的网址
import re
text = """https://bingo.render.com/vegenpropertymanagementllc.messio.com/2231/workOrders/9552?idp_type"""
work_order_id = re.search(r'workOrders/(\d+)/',text)
print(work_order_id)
company = re.search(r'.com/(.*)/',text)
print(company.group(1))
所需解决方案:
company = vegenpropertymanagementllc.messio.com
work_order_id = 9552
1条答案
按热度按时间s6fujrry1#
您可以使用urllib.parse轻松地隔离这两个必需的值,如下所示:
输出: