RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题

全部问题

Martin Hope
Culit
Asked: 2020-06-13 22:47:36 +0000 UTC

为什么 list.remove() 会错误地删除循环中的元素?

  • 9

我主要用 C/C++ 开发,但是出现了用 Python-3 编写应用程序的任务,遇到了对解释器的一些误解。

我犯了一个错误,有一段时间没有注意到它,因为 Python 做的一切“几乎”都是正确的。任务是从列表中删除 N/2 个值,其中 N 是它们的总数。

一个简单的例子来描述这种情况:

array = []

for i in range(10):
    array.append(i)
# array [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

i = 0
for item in array:
    if i < len(array)/2:
        array.remove(item)

# array [1, 3, 5, 7, 9]

如您所见,我没有i在第二个循环中增加变量,但不知何故,解释器仍然从数组中删除零和每个偶数元素。

实际上问题是,它是如何工作的?

python
  • 2 个回答
  • 10 Views
Martin Hope
Alrott SlimRG
Asked: 2020-05-15 06:49:33 +0000 UTC

在控制台中捕获键盘快捷键

  • 9

1)代码必须是跨平台的,或者2a代码选项(在Windows和Linux下)

2)我需要跟踪用户何时按下 Shift+Enter

3) 控制台程序

c++
  • 1 个回答
  • 10 Views
Martin Hope
wut cho
Asked: 2020-04-02 16:57:25 +0000 UTC

IndexOf 的处理是否不正确?

  • 9

此代码返回 0,尽管根据文档它应该返回 -1。难道我做错了什么?.NET 版本是 4.7.1。

Console.WriteLine("Dddd".IndexOf("⚽️", 0));
c#
  • 1 个回答
  • 10 Views
Martin Hope
Глеб Ростишевский
Asked: 2020-02-25 01:39:22 +0000 UTC

如何根据设计师的布局制作没有媒体查询的响应式应用?

  • 9

请告诉我在这种情况下如何最好地弥补,蜂窝?
我做了类似的事情,但有相同的边界(我附上了代码)。
在这种情况下,一切都变得更加困难,我没有太多想法如何做得更好。
第二个问题是如何正确定位这些块,以便以后不必过多地处理媒体查询?

在此处输入图像描述

.benefits__wrapper {
  text-align: center;
  padding-top: 3.9881vw;
  padding-bottom: 15px; }

.benefits__heading {
  margin-bottom: 6.84524vw; }

.benefits__items {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center; }
  @media screen and (max-width: 759px) {
    .benefits__items {
      -ms-flex-wrap: wrap;
          flex-wrap: wrap; } }

@media screen and (max-width: 759px) {
  .benefits__item {
    width: 40%;
    margin: 20px 0; } }

@media screen and (max-width: 459px) {
  .benefits__item {
    width: 100%; } }

.item {
  text-align: center;
  margin-right: 40px; }
  @media screen and (max-width: 459px) {
    .item {
      margin-right: 0; } }
  .item:last-child {
    margin-right: 0; }
  .item__title {
    position: relative;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    font: 1.25rem/1 "PFEncoreSansPro-Regular";
    color: #868686;
    margin-bottom: 34px; }
  .item__info {
    font: 0.9375rem/1.125rem "PFEncoreSansPro-Thin";
    color: #adadad;
    margin-bottom: 3.03571vw; }

.hexagon {
  margin: 0 auto 54px; }
  .hexagon__icon {
    fill: #fff;
    -webkit-transition: background-color .35s;
    transition: background-color .35s; }

.hexagon,
.hexagon__item_inner {
  position: relative;
  width: 91px;
  height: 52px;
  background-color: #fe8682;
  -webkit-transition: background-color .35s;
  transition: background-color .35s; }

.hexagon:before,
.hexagon:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fe8682;
  -webkit-transition: background-color .35s;
  transition: background-color .35s; }

.hexagon:before,
.hexagon__item_inner:before {
  -webkit-transform: rotate(120deg);
          transform: rotate(120deg); }

.hexagon:after,
.hexagon__item_inner:after {
  -webkit-transform: rotate(60deg);
          transform: rotate(60deg); }

.hexagon__item_inner {
  position: absolute;
  left: 0;
  top: 0;
  -webkit-transform: scale(0.9);
          transform: scale(0.9);
  background-color: #fc635e;
  z-index: 1; }

.hexagon__item_inner:before,
.hexagon__item_inner:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-transition: background-color .35s;
  transition: background-color .35s;
  background-color: #fc635e; }

.hexagon__content {
  position: relative;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  width: 100%;
  height: 100%;
  z-index: 1; }

.hexagon:hover,
.hexagon:hover:before,
.hexagon:hover:after {
  background-color: #fc635e; }

.hexagon:hover .hexagon__item_inner,
.hexagon:hover .hexagon__item_inner:before,
.hexagon:hover .hexagon__item_inner:after {
  background-color: #fff; }

.hexagon:hover .hexagon__icon {
  fill: #fc635e; }
<section class="benefits">
      <div class="benefits__wrapper container">
        <div class="benefits__heading">
          <div class="heading_usual">
            <div class="heading__title uppercase">What can
              <div class="span heading_active">you receive?</div>
            </div>
            <div class="heading__subtitle">
              Daisy is sagittis sem nibh id elit.   Duis sed odio sit amet nibh vulputate cursus a 
                sit amet mauris. Morbi accumsan ipsum
            </div>
          </div>
        </div>
        <div class="benefits__items">
          <article class="benefits__item item">
            <div class="hexagon">
              <div class="hexagon__item_inner"></div>
              <div class="hexagon__content">
                <svg class="hexagon__icon icon_xl">
                  <use xlink:href="svg/sprite.svg#rocket"></use>
                </svg>
              </div>
            </div>
            <div class="item__title uppercase">Clents</div>
            <div class="item__info">
              This is Photoshop's version  of Lorem Ipsum.   Proin gravida nibh vel velit auctor aliquet. Aenean</div>
          </article>
          <article class="benefits__item item">
            <div class="hexagon">
              <div class="hexagon__item_inner"></div>
              <div class="hexagon__content">
                <svg class="hexagon__icon icon_xl">
                  <use xlink:href="svg/sprite.svg#web-design"></use>
                </svg>
              </div>
            </div>
            <div class="item__title uppercase">branding</div>
            <div class="item__info">
              This is Photoshop's version  of Lorem Ipsum.   Proin gravida nibh vel velit auctor aliquet. Aenean</div>
          </article>
          <article class="benefits__item item">
            <div class="hexagon">
              <div class="hexagon__item_inner"></div>
              <div class="hexagon__content">
                <svg class="hexagon__icon icon_xl">
                  <use xlink:href="svg/sprite.svg#diagram"></use>
                </svg>
              </div>
            </div>
            <div class="item__title uppercase">marketing</div>
            <div class="item__info">
              This is Photoshop's version  of Lorem Ipsum.   Proin gravida nibh vel velit auctor aliquet. Aenean</div>
          </article>
          <article class="benefits__item item">
            <div class="hexagon">
              <div class="hexagon__item_inner"></div>
              <div class="hexagon__content">
                <svg class="hexagon__icon icon_xl">
                  <use xlink:href="svg/sprite.svg#speaker"></use>
                </svg>
              </div>
            </div>
            <div class="item__title uppercase">adv.</div>
            <div class="item__info">
              This is Photoshop's version  of Lorem Ipsum.   Proin gravida nibh vel velit auctor aliquet. Aenean</div>
          </article>
        </div>

html
  • 2 个回答
  • 10 Views
Martin Hope
Alexandr_TT
Asked: 2020-01-22 18:06:17 +0000 UTC

如何优化从矢量编辑器收到的 svg 代码

  • 9

我需要以某种方式优化来自矢量编辑器的代码Inkscape

例如,我正在绘制一个基本的 SVG 形状 - circle,其公式仅包含几行,以及所有 SVG 格式声明:

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" 
    xmlns:xlink="http://www.w3.org/1999/xlink"  width="40" height="40"    viewBox="0 0 40 40"  > 
    <circle cx="20" cy="20" r="18.1" style="fill:none;stroke-width:2;stroke:#00e700"/>  
</svg>	

我在矢量编辑器中绘制了相同的圆圈Inkscape并将其与生成的代码进行比较:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   version="1.1"
   width="40"
   height="40"
   viewBox="0 0 40 40"
   id="svg2"
   sodipodi:docname="Shape-circle.svg"
   inkscape:version="0.92.3 (2405546, 2018-03-11)">
  <metadata
     id="metadata8">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <defs
     id="defs6" />
  <sodipodi:namedview
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1"
     objecttolerance="10"
     gridtolerance="10"
     guidetolerance="10"
     inkscape:pageopacity="0"
     inkscape:pageshadow="2"
     inkscape:window-width="1400"
     inkscape:window-height="987"
     id="namedview4"
     showgrid="true"
     showguides="true"
     inkscape:guide-bbox="true"
     inkscape:zoom="11.8"
     inkscape:cx="17.033898"
     inkscape:cy="20"
     inkscape:window-x="-8"
     inkscape:window-y="-8"
     inkscape:window-maximized="1"
     inkscape:current-layer="svg2">
    <inkscape:grid
       type="xygrid"
       id="grid815" />
    <sodipodi:guide
       position="40,5"
       orientation="1,0"
       id="guide817"
       inkscape:locked="false" />
    <sodipodi:guide
       position="0,5"
       orientation="1,0"
       id="guide819"
       inkscape:locked="false" />
    <sodipodi:guide
       position="20,12.881356"
       orientation="1,0"
       id="guide821"
       inkscape:locked="false" />
    <sodipodi:guide
       position="35,0"
       orientation="0,1"
       id="guide823"
       inkscape:locked="false" />
    <sodipodi:guide
       position="31.864407,20"
       orientation="0,1"
       id="guide825"
       inkscape:locked="false" />
    <sodipodi:guide
       position="32.372881,40"
       orientation="0,1"
       id="guide827"
       inkscape:locked="false" />
  </sodipodi:namedview>
  <circle
     style="fill:none;fill-opacity:1;stroke:#00e700;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
     id="path829"
     cx="20"
     cy="20"
     r="18.135593" />
</svg>

文件大小2.5кB和94服务代码行Inkscape

如何优化代码、删除矢量编辑器的所有冗余服务信息、减少小数位数等。

html5
  • 3 个回答
  • 10 Views
上一页
下一页

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5