我想要一个<img>宽度为页面40%的宽度,并且它会被拉伸.
如何在不拉伸的情况下调整大小?
例如,如果我有一个图像的文件原来如下所示:
____8888________
____8888________
____8888________
Run Code Online (Sandbox Code Playgroud)
在我的网页中,通常看起来应该是这样的:
____8888________
____8888________
____8888________
Run Code Online (Sandbox Code Playgroud)
一旦我使浏览器变得更窄,max-width(在这个例子中假设10个字符)就会生效.
当发生这种情况时,我希望它是:
____8888__
____8888__
____8888__
Run Code Online (Sandbox Code Playgroud)
(就像它从右侧切割而来.当然从双方都更好),
而不是:
__888_____
__888_____
__888_____
Run Code Online (Sandbox Code Playgroud)
<div>背景中)都没关系.我正在写一个Python聊天机器人.无论技术是什么(Levenshtein,LCS,正则表达式等),我想要一个像My name is [ A ].智能足够的模式来匹配字符串,如:
My name is Tslmy. #Distance should = 0, and groupdict()['a'] outputs "Tslmy"
My name is Tesla Tahomana. #Distance should = 0(!), and groupdict()['a'] outputs "Tesla Tahomana"
my naem ist tslmy . #With a little typo, the distance = 5, and groupdict()['a'] outputs "tslmy "
Run Code Online (Sandbox Code Playgroud)
请允许我用来groupdict()['a']指代[ A ](实际上(?P<identifier>match))抓住的东西.
groupdict(),以及"模糊"值(或"编辑距离",需要确定"与字符串"稍后"匹配的最佳模式.groupdict()如果管理良好,它提供"足够" .那可能吗?感谢您的关注.
更新:
我决定最终使用强大的正则表达式模块,但仍然无法获得"模糊值".
由于 …