获取具有特定属性的div - Scrapy选择器

时间:2015-07-07 07:11:29

标签: scrapy

我的HTML看起来像:

<div class="row">
  <div class="col-md-6">
    <dl>
      <dt>Prerequisites</dt>
      <dd>15-510</dd>
    </dl>
  </div>
  <div class="col-md-6">
    <dl>
      <dt>Corequisites</dt>
      <dd>None</dd>
    </dl>
  </div>
</div>

我希望根据相应的<dd>获取<dt>内的值。例如,我想做一些像选择&#39;先决条件&#39;并获得&#39; 15-510&#39;。

谢谢。

1 个答案:

答案 0 :(得分:1)

<%@ Application %> <script runat="server" language="c#"> protected void Application_Error(Object sender, EventArgs e){ Exception ex = Server.GetLastError(); Server.ClearError(); Response.Write("<pre>"); Response.Write(Environment.NewLine); Response.Write("Caught Exception: " + ex.ToString() + Environment.NewLine); if (ex.InnerException != null){ Response.Write(Environment.NewLine); Response.Write("Inner Exception: " + ex.InnerException.ToString() + Environment.NewLine); Response.Write(Environment.NewLine); } System.Security.SecurityException ex_security = ex as System.Security.SecurityException; if (ex_security != null){ Response.Write(Environment.NewLine); Response.Write("Security Exception Details:"); Response.Write(Environment.NewLine); Response.Write("==========================="); Response.Write(Environment.NewLine); Response.Write("PermissionState: " + ex_security.PermissionState + Environment.NewLine); Response.Write("PermissionType: " + ex_security.PermissionType + Environment.NewLine); Response.Write("RefusedSet: " + ex_security.RefusedSet + Environment.NewLine); } Response.Write("</pre>"); } </script> 怎么样?