怎样提取连接中数字部分(语言-python)

wg='https://al.autohome.com.cn/auto_common_event?ahpvers=20200114&applid=1651114766717rCGUf9KSBN&ahpprlid=&ahpsign=6389345140&site=1&category=40&biz=media&type=show&action=hot-chat_chat-room&ctime=1651114768704'

import re
wg='https://al.autohome.com.cn/auto_common_event?ahpvers=20200114&applid=1651114766717rCGUf9KSBN&ahpprlid=&ahpsign=6389345140&site=1&category=40&biz=media&type=show&action=hot-chat_chat-room&ctime=1651114768704'
p = r'\d+'
nums = re.findall(p, wg)
print(nums)

img

你好,试一下把


import re
str_ = 'https://al.autohome.com.cn/auto_common_event?ahpvers=20200114&applid=1651114766717rCGUf9KSBN&ahpprlid=&ahpsign=6389345140&site=1&category=40&biz=media&type=show&action=hot-chat_chat-room&ctime=1651114768704'
number = re.findall("\d+",str_)    # 输出结果为列表

print(number)

输出

# 列表中的数字的数据类型是str
# ['11', '32', '4', '677', '88']