如何在Python中从文本框中获取所有内容

2024-05-12 21:28:39 发布

您现在位置:Python中文网/ 问答频道 /正文

我的新项目面临一些困难时期。基本上,我需要的是使用Python-Selenium-Webdriver获取这个html代码段中的所有文本。你知道吗

我需要的部分是:

<div class="both"></div>




<div class="st-box" id="source-code">
    <h3>CÓDIGO FONTE</h3>

    <div class="wrap code-answer-1">

        <pre id="code" class="code-2">
#include &lt;bits/stdc++.h&gt;

using namespace std;


int main(){
  double v, d;
  while(cin &gt;&gt; v &gt;&gt; d)
  {
    double a = (d/2.)*(d/2.) * 3.14;
    // v = a * h , h = v / a
    printf(&quot;ALTURA = %.2lf\nAREA = %.2lf\n&quot;, v/a, a);
  }

}
</pre>

        </div>
    </div>
</div>

我需要#include之后的一切。你知道吗

我的剧本很奇怪。我找不到超过33行的文字。另外,33 lines of text是页面中出现的行数(我必须在文本框中向下滚动以查看更多文本)。我找不到一个方法来做这件事,并得到整个文本,我尝试了很多事情,也有一些问题,我可以在这里找到。你知道吗

整页html代码:https://ghostbin.com/paste/homo8

我的脚本:https://ghostbin.com/paste/5re7h


Tags: https文本gtdividincludehtmlcode