argparse - 禁用相同的参数发生(argparse - disable same argument occurrences)
我试图禁用一个命令行中使用argparse相同的参数发生
./python3 --argument1=something --argument2 --argument1=something_else
这意味着这应该引发一个错误,因为argument1的值被覆盖,默认情况下,argparse只是覆盖该值,并继续像没有发生任何事情......有没有聪明的方法来禁用这种行为?
I'm trying to disable same argument occurences within one command line, using argparse
./python3 --argument1=something --argument2 --argument1=something_else
which means this should raise an error, because value of argument1 is overriden, by default, argparse just overrides the value and continues like nothing happened... Is there any smart way how to disable this behaviour?
原文:https://stackoverflow.com/questions/23032514
更新时间:2022-05-02 06:05
最满意答案
像这样的东西应该做的伎俩?
jQuery( function( $ ) { var images = [ "bg-1.jpg", "bg-2.jpg", "bg-3.jpg", "bg-4.jpg", "bg-5.jpg" ]; var currentImage = 0; function changeBackground() { $( '#page_bg' ).css( { backgroundImage: 'url(' + images[ ++currentImage ] + ')' } ); if ( currentImage >= images.length - 1 ) { currentImage -= images.length; } } setInterval( changeBackground, 5000 ); });
Something like this should do the trick?
jQuery( function( $ ) { var images = [ "bg-1.jpg", "bg-2.jpg", "bg-3.jpg", "bg-4.jpg", "bg-5.jpg" ]; var currentImage = 0; function changeBackground() { $( '#page_bg' ).css( { backgroundImage: 'url(' + images[ ++currentImage ] + ')' } ); if ( currentImage >= images.length - 1 ) { currentImage -= images.length; } } setInterval( changeBackground, 5000 ); });
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
你应该删除额外的冒号:从第一个参数background-image传递给css()函数: $(".profile-photo").css("background-image","url(data:image/png;base64," + profilePhoto + ")"); 代替 : $(".profile-photo").css("background-image:","url(data:image/png;base64," + profilePhoto + ")"); ______________ ...
-
您可以使第二个div以相反方向旋转。 $(function() { var rotation = 0, rotation2=0, scrollLoc = $(document).scrollTop(); $(window).scroll(function() { var newLoc = $(document).scrollTop(); var diff = scrollLoc - newLoc; rotation += dif ...
-
“img被推下来,即不再位于网格中的左上角位置” 这是因为你正在使用translateX ,如果你只想旋转图像,不要移动它,只使用transform: rotate : * { padding: 0; margin: 0; } .rotate_ninety { -moz-transform: rotate(90deg); -webkit-transform: rotate(90deg); -o-transform: rotate(90deg); - ...
-
更改 $('#equipment').click(function(){ $('#equipment').toggleClass('flashOn'); }); 至 $('#equipment').click(function(){ $('#equipment').toggleClass('flashOn flash'); }); http://jsfiddle.net/osmanrahimi/xwnKP/215/ change $('#equipment').click(fu ...
-
jquery简单动画/旋转css背景图像在div内?(jquery simple animate/rotate of a css background-image inside a div?)[2023-09-23]
像这样的东西应该做的伎俩? jQuery( function( $ ) { var images = [ "bg-1.jpg", "bg-2.jpg", "bg-3.jpg", "bg-4.jpg", "bg-5.jpg" ]; var currentImage = 0; function changeBackground() { $( '#page_bg' ).css( { backgroundImage: 'url(' + images[ ++currentIm ... -
到目前为止,在背景图像之间进行插值的能力是一个非常新的提议,并且在浏览器中得不到很好的支持。 Firefox还没有实现它。 The ability to interpolate between background images is a pretty new proposal so far, and not well supported in browsers. Firefox doesn't implement it yet.
-
jQuery中的转换效果适用于可以数字设置的值。 您可以通过更改RGB值将一种颜色淡化为另一种颜色。 您可以通过降低透明度来淡化图像。 交叉褪色两个背景图像是完全不同的东西。 涉及的唯一CSS值是background-image属性,它是一个URL。 jQuery实际上通过淡出和淡出另一个来很好地解决它。 我能想到的最简单的事情是在彼此之上使用两个div。 淡出最顶层div的透明度,使底部div可见。 根据图像的内容不应该看起来太糟糕。 Now I constructed a solution, thank ...
-
之后为现有的jquery css添加“背景图像”更改(Adding a “background-image” change to existing jquery css change afterwards)[2023-04-17]
我将背景应用于#wps-sidebar而不是#popup,然后...... #wps-sidebar.opened { left: 30px; background: url(../popupclose.jpg) center right no-repeat #fff; } ...... jQuery(document).ready(function(){ jQuery('a#popup').toggle(function () { jQuery("#wps-sidebar").addClass("ope ...