首页 \ 问答 \ 用Python / BS4刮表(Scraping Table With Python/BS4)

用Python / BS4刮表(Scraping Table With Python/BS4)

我试图从http://www.pro-football-reference.com/boxscores/201602070den.htm用BS4和Python 2.7抓取“Team Stats”表。 但是我无法靠近它,

url = 'http://www.pro-football-reference.com/boxscores/201602070den.htm'
page = requests.get(url)
soup = BeautifulSoup(page.text, "html5lib")
table=soup.findAll('table', {'id':"team_stats", "class":"stats_table"})  
print table

我认为像上面的代码可以工作,但没有运气。


Im trying to scrape the "Team Stats" table from http://www.pro-football-reference.com/boxscores/201602070den.htm with BS4 and Python 2.7. However Im unable to get anywhere close to it,

url = 'http://www.pro-football-reference.com/boxscores/201602070den.htm'
page = requests.get(url)
soup = BeautifulSoup(page.text, "html5lib")
table=soup.findAll('table', {'id':"team_stats", "class":"stats_table"})  
print table

I thought something like the above code would work but no luck.


原文:https://stackoverflow.com/questions/38575120
更新时间:2022-05-14 07:05

最满意答案

Forge 设计自动化 API可能有助于这种情况,您可以使用Autodesk产品的云引擎(如AutoCAD,Revit,Inventor等)来读取文件详细信息。 你需要做的是编写一些小插件来读取存储在文件中的软件版本。

此外,您还可以使用一些第三方工具来归档相同的目标:

  1. RVT文件实际上是一个OLE文档,您可以使用OLE library for .NET来读取RVT内的软件版本,请查看Jeremy的这个博客Basic File Info和RVT File Version
  2. DWG可以作为文本文件读取,您可以使用正则表达式来提取版本号,请参阅此处

Forge Design Automation APIs might help this case, you can use cloud engines of Autodesk product (such as AutoCAD, Revit, Inventor, etc.) to read file details. What you have to do is writing some tiny add-ins to read software version stored in the file.

Besides, you can use some third-party tools to archive the same goal as well:

  1. RVT file is actually an OLE document, you can use OLE library for .NET to read software version inside RVT, please check this blog Basic File Info and RVT File Version from Jeremy.
  2. The DWG can be read as a text file, you can use the regular expression to extract the version number out, please refer here.

相关问答

更多
  • 不知何故,当安装服务器时,它没有安装nginx,所有必要的东西。 在Forge中列出了已安装的内容,但显然缺少了。 所以我决定销毁它并安装新的服务器。 新的工作应该是这样的。 Somehow when server was installed it did not install nginx, and all what was necessary. In Forge was listed what was installed and that was clearly missing. So I decide ...
  • 我还有一个使用Forge NPM的教程来完成创建存储桶以上传文件并翻译它的整个过程。 我认为你遇到问题的部分是上传部分 检查这个https://github.com/jaimerosales/modelderivative-nodejs-tutorial/blob/master/uploader.js#L145 I have also a tutorial using the Forge NPM to do the whole process of creating bucket to upload fil ...
  • Forge 设计自动化 API可能有助于这种情况,您可以使用Autodesk产品的云引擎(如AutoCAD,Revit,Inventor等)来读取文件详细信息。 你需要做的是编写一些小插件来读取存储在文件中的软件版本。 此外,您还可以使用一些第三方工具来归档相同的目标: RVT文件实际上是一个OLE文档,您可以使用OLE library for .NET来读取RVT内的软件版本,请查看Jeremy的这个博客Basic File Info和RVT File Version 。 DWG可以作为文本文件读取,您可 ...
  • 在尝试并获得很多意见之后,唯一的方法就是我评论道: 从自动加载器中删除数据库; 使用多个数据库,默认的数据库是相同的,但创建第二个具有空数据库名称的数据库; 对Forge类使用第二个数据库而不是默认值,仅用于创建数据库和表; 手动更改默认数据库并在此之后使用。 After try and get a lot of opinions, the only way is as I commented: Remove database from autoloader; Use multiple databases, ...
  • 好的,我可以收集... 新创建的节点(您的屏幕截图顶部有两个节点)默认情况下未连接任何内容。 看起来预览是使用这些不连接的节点,而不是你的新节点,我不确定这里是什么。 这可能是一个错误。 尝试删除坏节点(全部四个)并重新创建它们。 尝试更新Shader Forge。 (我不能重现这种行为) 你的法线贴图可能不是一个有效的法线贴图 ,因此它的(几乎完美)纯色没有任何真正的功能 : 右边是你自己的凹凸纹理的近似值,左边是用作所述纹理的平均值的纯色。 与真正的凹凸贴图相比: Slider值并不真正“更新”着色器( ...
  • 我正在运行和较早版本的eclipse和Jboss工具插件。 更新后,它按照预期的方式工作。 I was running and older version of eclipse and the Jboss tool plugin. After updating it works as aspected.
  • 在forge run android命令期间创建了一个APK,但在设备上安装后会立即删除它; 如果您需要创建一个APK以供在其他地方使用或上传到Google Play,请参阅forge package android 。 http://docs.trigger.io/en/v1.3/releasing.html#android An APK is created during the forge run android command, but it's deleted immediately after ...
  • 试试最新的1.6.4版本。 Minecraft改变了他们的资源和图书馆的位置,因此Forge现在正在寻找错误的地方。 最后的1.6.4使用旧的安装系统,但是如果你愿意,你可以使用第二个到最后的1.6.4版本来尝试名为ForgeGradle的新构建系统。 这是一个好主意,因为这是1.7+的唯一方法。 祝你好运! (PS如果你想坚持1.6.2,你可以从1.6.4脚本中抢夺新的位置) Try the latest 1.6.4 version. Minecraft changed the location of t ...
  • 你需要为你的桶提出一个独特的名字,对于那个坏消息抱歉。 你的想法并不糟糕。 例如,只需将您的client_id添加到存储桶名称即可: "test-tAp1fqjjtcgqS4CKpCYDjAyNbKW4IVCC" 或者使用代码生成的随机guid: function guid() { var d = new Date().getTime(); var guid = 'xxxx-xxxx-xxxx'.replace( /[xy]/g, function (c) { ...
  • 从版本2.9开始,这仍然有效。 这是我的控制台: 您可以尝试以下几种方法: viewer未定义吗? 抓住viewer时,你是否在正确的范围内? 在获取实例树之前,必须先加载该文档。 加载文档时,将触发名为Autodesk.Viewing.GEOMETRY_LOADED_EVENT的事件,然后您可以开始操作实例树。 只需这样做: viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function () { var instanceT ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)