text 相关问题

文本是一系列字符,最常用于表示一段有凝聚力的信息。

文本的应用程序/纯 MIME 类型?

我在某些来源中看到过这个应用程序/普通文件带有 .text 后缀。它有效吗?是否在任何地方使用过?或者这只是某人编制了一份清单而其他人只是复制的情况......

回答 2 投票 0

我怎样才能只删除文本之间的单行以将其分成块?

我有一个文本文件: 标题 标头 主题一二三 你好哈利 我只想删除文本之间的单行以获得: 标题 标头 主题一二三 你好哈利 我如何使用 py 来做到这一点...

回答 1 投票 0

为文本背景颜色添加填充

我想让文本“突出显示”,但不是整个文本框。我希望每一行都单独突出显示。我还没有找到实现这一目标的最佳方法。唯一的...

回答 1 投票 0

在Excel中提取第一个正斜杠之前和之后的字符串

我有许多Excel单元格,我想在其中抓取第一个正斜杠之前和之后但在第二个正斜杠之前且没有斜杠本身的文本,例如以下...

回答 1 投票 0

如何在 React-Native (JavaScript) 中显示文本更多/更少

我正在开发反应本机应用程序。其中,我们正在显示一些关于文本的描述,它可能是行数。 所以,如果数据超过 3 行,如果展开的话我必须显示更多和更少...

回答 9 投票 0

Python:删除两个给定 HTML 标签之间的所有内容

选择的编程语言是Python。 这是我的 HTML 文本: 原消息 选择的编程语言是Python。 这是我的 HTML 文本: <a href="https://www.example.com">Original message</a><br> <ul id="list"> <li class="blockbody" id="post_1"> <div class="header"> <div class="datetime"> 24 januari 2020, 11:34 </div><span class="name">Jane Doe</span> </div> <div class="content"> <blockquote class="restore"> <div class="bbcode_container"> <i class="fa fa-envelope"></i> Citation: <div class="bbcode_quote printable"> <hr> <div> Citation: John Doe <a href="showthread.php#post684209" rel="nofollow"><img alt="" class="inlineimg" src="image/style/Aesthetica/button/view.gif"></a> </div> <div class="message"> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div> <hr> </div> </div><br> <div class="bbcode_container"> <i class="fa fa-envelope"></i> Citation: <div class="bbcode_quote printable"> <hr> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum?<br> <br> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.<br> <br> quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.. <hr> </div> </div>... <a href="https://example.com" target="_blank">https://example.html</a><br> <br> velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum? </blockquote> </div> </li> </ul> 我想删除 THE FIRST <div class="bbcode_quote printable"> 和 THE LAST <hr> 标签之间的所有内容。正如您所看到的,这两个标签都有多个实例,这就是为什么我强调第一个和最后一个。 我熟悉 Python,但字符串操作不是我的专业领域。 我希望我已经说清楚了。 您可以使用 Beautiful Soup 库 - https://pypi.org/project/beautifulsoup4/ 参考: 使用BeautifulSoup查找具有两种特定样式的标签 如何删除特定 html 标签内的所有内容(以及标签本身) from bs4 import BeautifulSoup # The HTML string provided html = """ <a href="https://www.example.com">Original message</a><br> <ul id="list"> <li class="blockbody" id="post_1"> <div class="header"> <div class="datetime"> 24 januari 2020, 11:34 </div><span class="name">Jane Doe</span> </div> <div class="content"> <blockquote class="restore"> <div class="bbcode_container"> <i class="fa fa-envelope"></i> Citation: <div class="bbcode_quote printable"> <hr> <div> Citation: John Doe <a href="showthread.php#post684209" rel="nofollow"><img alt="" class="inlineimg" src="image/style/Aesthetica/button/view.gif"></a> </div> <div class="message"> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div> <hr> </div> </div><br> <div class="bbcode_container"> <i class="fa fa-envelope"></i> Citation: <div class="bbcode_quote printable"> <hr> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum?<br> <br> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.<br> <br> quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.. <hr> </div> </div>... <a href="https://example.com" target="_blank">https://example.html</a><br> <br> velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum? </blockquote> </div> </li> </ul> """ soup = BeautifulSoup(html, 'html.parser') # Find the first div with class "bbcode_quote printable" first_quote = soup.find('div', class_='bbcode_quote printable') # Find all hr tags in the first div, get the last hr tag last_hr = first_quote.find_all('hr')[-1] # Extract all contents between the first hr and the last hr start = first_quote.hr end = last_hr # Extract all elements between these two tags current = start.find_next_sibling() while current and current != end: current.extract() current = start.find_next_sibling() # This will remove the first <hr> also, if you want to keep it uncomment below line # last_hr.extract() # Optionally remove the last <hr> as well, depending on requirements # Print the modified HTML print(str(soup))

回答 1 投票 0

自动缩进换行文本

这里有点菜鸟,但我基本上希望文本在换行时自动缩进。 所以而不是: 彼得·派珀 (Peter Piper) 啄了一下 泡椒。 这将是: 彼得·派珀 (Peter Piper) 啄了一下 的

回答 3 投票 0

如何检查 Go 中文本模板数据中是否存在某个键?

我想检查传递给 template.Exec 函数的数据中是否存在键(不存在!=零值)。使用 {{if 或 {{with 有效,但前提是键的值不为零值。 {{如果.N...

回答 1 投票 0

有什么方法可以仅向 TextFormField 中的 labelText 添加填充吗?

我正在创建一个 Flutter 应用程序,我想仅向 TextFormField 中的 labelText 添加水平填充,而不是向hintText 和输入文本添加水平填充。我正在使用 contentPadding 但它增加了填充

回答 2 投票 0

带有上下文的 Langchain sql 代理

我正在开发一个基于 langchain 的 SQL 聊天应用程序,并希望我的代理能够理解用户会话的上下文。例如 用户 - 最后放置的最高订单是什么? 机器人 - 订单 ID ...

回答 1 投票 0

Flutter Text 如何去除右侧空白

如您所见,文本右侧有空白区域,如何删除它。 使用 CustomPainter 可以解决这个问题,但我需要先计算文本宽度。 有没有其他方法可以去除...

回答 1 投票 0

包含文本的 CSS 三角形

我手头有一个奇怪的问题,我正在努力寻找解决方案。 我仅使用 CSS 创建了一个三角形 “容器”,但我现在想要的是在 内插入一些文本 我手头有一个奇怪的问题,我正在努力寻找解决方案。 我仅使用 CSS 创建了一个三角形 <div>“容器”,但我现在想要的是在容器内插入一些文本。 我想要的解决方案必须将文本包含在三角形的边界内,无论我要创建缩略图时插入多少文本。 可以在here找到示例[注意;这个例子非常基本,只展示了我选择创建三角形的方式] 再往前推一点,我想创建一个面朝上的三角形和一个面朝下的三角形,并且文本必须位于每个三角形的底部,因此对于第一个三角形,文本将位于底部,第二个三角形的文本将位于底部。顶部,B 计划只是将文本在三角形内垂直和水平居中。 CSS: .up { text-align:right; width: 0px; height: 0px; border-style: inset; border-width: 0 100px 173.2px 100px; border-color: transparent transparent #007bff transparent; float: left; transform:rotate(360deg); -ms-transform:rotate(360deg); -moz-transform:rotate(360deg); -webkit-transform:rotate(360deg); -o-transform:rotate(360deg); } HTML: <div class="up"> <p>some information text goes here<p> </div> 对于你的B计划(将文本在三角形内垂直和水平居中),我更喜欢作为解决方案,你可以添加以下CSS规则: .up p { text-align: center; top: 80px; left: -47px; position: relative; width: 93px; height: 93px; margin: 0px; } 在这里尝试一下: .up { width: 0px; height: 0px; border-style: inset; border-width: 0 100px 173.2px 100px; border-color: transparent transparent #007bff transparent; float: left; transform: rotate(360deg); -ms-transform: rotate(360deg); -moz-transform: rotate(360deg); -webkit-transform: rotate(360deg); -o-transform: rotate(360deg); } .up p { text-align: center; top: 80px; left: -47px; position: relative; width: 93px; height: 93px; margin: 0px; } <div class="up"> <p>some information text goes here <p> </div> 在 JSFiddle 上查看 无论有多少文本,如何将文本放入三角形内?据我所知,仅靠 CSS 是不可能的。无法容纳的文本将会溢出,您需要使用 Javascript 相应地调整字体大小以适应所有文本。 但是假设您希望将合理数量的文本放入直角三角形内(底边在左侧,指向右侧),这里有一种方法: 创建一个具有固定宽度和高度的容器来容纳文本和形状。 在容器内,创建两个向右浮动的 div。每个的宽度为 100%,高度为 50%,形状轮廓和剪辑路径为多边形。 为这些 div 提供类似于渲染页面背景的背景颜色。 这个想法是,这两个 div 之外的部分将采用我们正在寻找的三角形形状。 在 CSS 中,元素都是矩形,无论你是否意识到。这不是画三角形。这是关于创建暗示三角形的相邻元素。希望这是有道理的。 .main { width: 400px; height: 200px; position: relative; background: peachpuff; } .top, .bottom { width: 100%; height: 50%; background: white; } .top { -webkit-shape-outside: polygon(0% 0, 100% 0%, 100% 100%); shape-outside: polygon(0% 0, 100% 0%, 100% 100%); float: right; -webkit-clip-path: polygon(0% 0, 100% 0%, 100% 100%); clip-path: polygon(0% 0, 100% 0%, 100% 100%); } .bottom { height: 50%; float: right; bottom: 0; clip-path: polygon(0% 100%, 100% 100%, 100% 0%); shape-outside: polygon(0% 100%, 100% 100%, 100% 0%); } <div class="main"> <div class="top"></div> <div class="bottom"></div> <p> When should one use CSS versus SVG? Use CSS for simple shapes. HTML elements are rectangles, so all you are doing is creating an illusion of shapes. Sometimes this can become a deep rabbit hole. Instead, use SVG for complex shapes. </p> </div> 使用 shape-outside CSS 属性来定义代码应围绕的区域。 .main { width: 100%; height: 200px; position: relative; background: blue; } .left, .right { width: 50%; height: 100%; background: white; } .left { shape-outside: polygon(0% 0, 0% 100%, 100% 0%); clip-path: polygon(0% 0, 0% 100%, 100% 0%); float: left; } .right { shape-outside: polygon(0 0, 100% 0, 100% 100%); clip-path: polygon(0 0, 100% 0, 100% 100%); float: right; } p { text-align: center; } <div class="main"> <div class="left"></div> <div class="right"></div> <p> A saepe natus ad incidunt libero in eligendi consequatur non libero commodi aut ullam ullam non voluptas aliquid. Vel culpa atque sit. </p> </div>

回答 3 投票 0

使用 size_hint 时 Kivy 按钮文本消失

这里是新手程序员。尝试在我的 python/kivy 应用程序中实例化一个按钮,每当我设置 size_hint 时,按钮文本就会消失。目标是拥有一个大小为 0.1 x 0.1 的按钮...

回答 1 投票 0

PDF 的文本选择顺序由什么决定,生成 PDF 时如何改进?

许多 PDF,尤其是通过演示软件、桌面排版或 Latex 排版导出的 PDF,似乎具有不合逻辑的文本选择选取框顺序。 例如选择零件...

回答 2 投票 0

python plt.text 中的重叠,包 adjustment_text 不起作用,如何修复它?

我有两个名为“freq”和“freq1000”的 pandas 数据框对象,每个对象都是由 5 个数字组成的向量。我想将它们绘制在同一个图表上,并在图表上显示 plt.text 以显示 y 值。 “频率”和“

回答 1 投票 0

当 xmin = xmax 时如何使用 Praatio 打开文本网格

我尝试用 praatio 打开文本网格: 从 praatio 导入 textgrid tg = textgrid.openTextgrid(myfile) 但在这个文本网格中,有时会发生 xmin = xmax : “间隔 [11]:xmin = 3.34,

回答 1 投票 0

内联脚本随机化句子的一部分

我正在构建一个网页,我想在页面加载/重新加载时显示句子的部分内容。 例如: 我喜欢蘑菇酱意大利面 重新加载后变成这样: 我喜欢黄油扁豆 开始...

回答 1 投票 0

为什么我的宏不能用于替换文本?

有人可以告诉我为什么下面的代码不起作用。这就是我想要它做的。 如果 D 列中的单元格显示 emilio pucci 或 max mara 或 tom ford,并且如果它在 col 中看到“太阳镜”一词...

回答 1 投票 0

我怎样才能让它停止一小会儿然后又继续滚动

https://codepen.io/lucabeingluca/pen/vYMPLZN 再来一个更长的 ... https://codepen.io/lucabeingluca/pen/vYMPLZN <div class="wrapper"> <div class="marquee"> <p> longer one again </p> <p> longer one again </p> </div> </div> .wrapper { max-width: 10%; overflow: hidden; } .marquee { white-space: nowrap; overflow: hidden; display: inline-block; animation: marquee 7s linear infinite; } .marquee p { display: inline-block; } @keyframes marquee { 0% { transform: translate3d(0, 0, 0); } 100% { transform: translate3d(-50%, 0, 0); } } 我希望它在完成一个“再长一个”后,它会停止一个短暂的半秒,然后继续滚动,它只是重复有点像苹果音乐滚动动画,当标题太长时,它会开始滚动,然后停止一段时间短暂的一秒钟然后继续。 yk:) 我不知道该尝试什么,因为我很笨:/ 我们可以在 10% 处添加另一个关键帧,将位置保持在 0,这样 0% 到 10% 之间就不会发生任何变化,然后滚动动画的其余 90%。 .wrapper { max-width: 10%; overflow: hidden; } .marquee { white-space: nowrap; overflow: hidden; display: inline-block; animation: marquee 7s linear infinite; } .marquee p { display: inline-block; } @keyframes marquee { 0% { transform: translate3d(0, 0, 0); } 10% { transform: translate3d(0,0,0); } 100% { transform: translate3d(-50%, 0, 0); } } <div class="wrapper"> <div class="marquee"> <p> longer one again </p> <p> longer one again </p> </div> </div>

回答 1 投票 0

如何删除文件中位置 51 处的所有 CRLF,以相反的顺序处理文件

我有一个很大的文本文件,输出该文件的应用程序将其自动换行为 50 个字符。 实际的原始展开行长度差异很大,从 1 个字符到 1500 多个字符不等。 ...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.