Python BeautifulSoup获取没有页面结构的数据

Python BeautifulSoup获取没有页面结构的数据,python,html,beautifulsoup,Python,Html,Beautifulsoup,以下是网页: <html> <head> <!--eBay V3- msxml 6.0 XXXXXXXXXXXXXXXXXXXXXXXXXX--> <!--srcId - File Exchange Programmatically Upload--> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <title>Upload File

以下是网页:

<html>
<head>
<!--eBay V3- msxml 6.0 XXXXXXXXXXXXXXXXXXXXXXXXXX-->
<!--srcId - File Exchange Programmatically Upload-->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Upload File Programmatically</title><script language="JavaScript"><!--
                                                                var pageName = "File Exchange Upload";

                                                        //--></script><script language="javascript" src="http://include.ebaystatic.com/js/e867/us/legacy/globals_e8672us.js"> </script><script src="http://include.ebaystatic.com/js/e885/us/legacy/common_functions_e8852us.js"> </script></head>
<body>
                                File upload successful. Your ref # is 711103172.<br><a href="javascript:void(0);" onclick="self.close();return false;">Close</a></body>
</html>

以编程方式上载文件
文件上载成功。您的参考号是711103172。
我只需要提取号码711103172,BeautifulSoup是否适用于此?或者其他一些方法(我现在使用的是BS),但是这个页面没有什么结构

我可以从body中获取数据来返回:

<body>
                                File upload successful. Your ref # is 711103172.<br><a href="javascript:void(0);" onclick="self.close();return false;">Close</a></body>

文件上载成功。您的参考号为711103172。

但是,一旦我到了那里,我就被卡住了。

使用
BeautifulSoup
获取
正文
文本,然后使用提取所需数字:

import re
from bs4 import BeautifulSoup

data = """
    Your HTML code here
"""

soup = BeautifulSoup(data, "html.parser")
match = re.search(r'Your ref # is (\d+)', soup.body.text)
print match.group(1) if match else 'Not Found'
印刷品:

711103172
仅供参考,
(\d+)
正则表达式的一部分是。
\d+
匹配一个或多个数字