问题标签 [python-beautifultable]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
1142 浏览

python - 用电子邮件发送表格时漂亮的表格对齐方式

我的表格在控制台中打印得很好,但是当我通过电子邮件发送它时,它的对齐方式有点失真,有什么建议可以完美地发送它,就像它在控制台中打印一样?

控制台输出:

电子邮件输出:

在此处输入图像描述

但是当将它从电子邮件复制到记事本时,对齐会恢复正常

0 投票
1 回答
540 浏览

python - 使用 python Beautiful Table 模块打印出多维数组

我正在尝试使用 Python2.7 中的 Beautiful Table 模块以表格格式打印出多维数组。

我尝试了以下代码:

但它打印出以下错误:

ValueError: '预期的迭代长度为 4,得到 5"

0 投票
4 回答
2190 浏览

python - 如何为 BeautifulTable 设置单元格宽度大小?

我正在使用 python 模块BeautifulTable向控制台发出一个表。它包装了一些标题和内容,我想设置单元格宽度,所以它不会这样做。

我尝试通过table.column_widths(根据文档)设置宽度,但这似乎没有任何效果。

0 投票
0 回答
50 浏览

html - 如何读取未反映在美丽汤对象中的 html 标签

我正在尝试为我的业余项目抓取动漫电视连续剧的页面,并遇到了这个我无法提取完整 div 标签的小问题。

链接:https ://gogoanime.in/category/boruto-naruto-next-generations

我想在这里刮掉这个东西:在此处 输入图像描述

我正在使用的代码是这样的:

运行代码后,我得到了 NoneType 输出。请让我知道可以做些什么。

0 投票
1 回答
2469 浏览

python - Beautiful Soup 找不到我想要的 HTML 部分

我一直在使用 BeautifulSoup 进行网页抓取,这是我第一次遇到这样的问题。我试图在代码中选择数字 101,172,但即使我使用 .find 或 .select,输出始终只是标签,而不是数字。我以前做过类似的数据收集工作,没有遇到任何问题

我用了:

输出:

此外,我正在寻找的数据编号是动态的,所以我不确定 Javascript 是否会影响 BeautifulSoup

0 投票
1 回答
183 浏览

python - Make Soup Not Getting All Data

I will apologize now as I am sure the format of my question and the information I provide will not be up to par with what is expected on this site. I have been coding SQL and VBA for several years and I am trying to pick up a 3rd language to enhance my skill set. I will get better with time.

Now to my issue...

I am trying to scrape a series of tables with code that has worked on BasketballReference.com however on NBA.com the code brings back nothing. When digging further the make_soup does not contain the tr and td tags that I see when inspecting the table in my browser. Below is the code I am using and for reference a picture of what my csv file looks like.

PlayTypeKey.csv data:

My limited ability to trouble shoot tells me that the table data is not coming back when I make the soup out of the URL. When printing the text of the soup I get this...

Towards the bottom of what is pasted above are the headers of the table but no corresponding text or code for the table itself. I won't clutter this post with what I get when printing the HTML but I get no hits when searching for the tr or td tags.

Thanks in advance for anyone that spends time looking into this and I just want to say this site has already been immensely valuable to me.

0 投票
2 回答
321 浏览

python - Beautifulsoup - 根据前一个 div 子标签从下一个 div 子标签中提取文本

我正在尝试根据以前的 div-span text.below 提取下一个 div 跨度中的数据,下面是 html 内容,

我试图找到文本使用,

然后尝试使用下一个兄弟姐妹获取文本,

但是,由于字段中的“\n”,我无法找到跨度并提取 next_sibling 文本。

简而言之,我正在尝试以以下格式形成一个字典,

对此的任何帮助或想法表示赞赏。

0 投票
1 回答
146 浏览

python - BeautifulSoup Soup findall 只提取类数据

我只想提取 < > 标签之间的类行中的数据,html行是:

我正在使用这段代码,但它返回了竞争行,我只想要字符串的 ABC 部分。

我怎样才能从 html 字符串中删除数据?

0 投票
2 回答
503 浏览

python - 无法从美丽的汤中读取 html 页面

下面的代码在输出中打印 hi 后卡住了。你能检查一下这有什么问题吗?如果该站点是安全的并且我需要一些特殊的身份验证?

0 投票
1 回答
59 浏览

python - 使用 python 抓取多个页面 - 输出问题

新年快乐蟒蛇社区,

我正在尝试使用 Python Beautifulsoup4 从网站中提取表格

我很难在我的输出文件中看到结果。代码运行顺利,但没有写入文件。

我的代码如下