def main_data():
archive_file = input("\nВведите адрес архива ")
# делаем проверку расширения файла
if archive_file.endswith('.zip') or archive_file.endswith('.rar') == False:
print(" Вы указали неверный файл. Файл не имеет расширения 'zip' или 'rar' ")
主页
/
user-363918
AleksandrM's questions
我想在 Linux Mint 中安装 osrframework 在安装过程中,它说
alex@alex-Lenovo-ideapad-320-15IAP:~$ sudo -H pip install osrframework
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting osrframework
Using cached osrframework-0.20.1.tar.gz (209 kB)
**ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bDobBZ/osrframework/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bDobBZ/osrframework/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-_c2o2O
cwd: /tmp/pip-install-bDobBZ/osrframework/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-bDobBZ/osrframework/setup.py", line 161
print(f"\t> {cmd}")
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.**
最初,使用 display: none 隐藏菜单(触发该功能时,我通过 js 更改样式)。该函数在加载时触发一次,当我单击菜单汉堡时,列表打开,当我想关闭它并再次单击菜单汉堡时,列表不会关闭。
let burgerMenu = document.querySelector(".burgerMenu"); // Это стилизованный блок с тремя горизонтальными линиями (бургер меню) по которому происходит клик.
let menu = document.querySelector(".menu"); // Это список ul? который должен выпадать и сворачиваться.
burgerMenu.onclick = () => {
if (menu.style.display = "none") {
menu.style.display = "block";
} else if (menu.style.display = "none") {
menu.style.display = "none";
}
}
let list = {
'cat': 'кот',
'dog': 'собака',
'door': 'дверь'
};
let card = document.querySelector(".card");
card.onclick = function () {
for (let key in list) {
card.innerHTML = key + " ";
}
}
card.onclick = function () {
for (let key in list) {
card.innerHTML = list[key];
}
}
你好。为什么这在这里不起作用。如何将新类应用于特定 div(但 [i])。当按下键盘键时(例如,1,它也有一个符号!),键改变颜色是必要的(为此添加了一个新类)。每个 div 是一个单独的键盘键
<label for="#inp">
<h2>Введите что нибудь: </h2>
</label><input type="text" id="inp"></div>
<div class='digit'>
<div class="div-1 buttoN"> 1 </div>
<div class="div-2 buttoN"> 2 </div>
<div class="div-3 buttoN"> 3 </div>
<div class="div-4 buttoN"> 4 </div>
<div class="div-5 buttoN"> 5 </div>
let inp = document.querySelector("#inp"); // Получаю значения из input
let but = document.querySelectorAll('.buttoN'); // Получаю множество блоков div
inp.onkeydown = function (event) {
for (var i = 0; i < but.length; i++) {
but[i].textContent == event.code;
if (event.code == 'Digit1') {
**this.but[i].classList.toggle('colY');**
inp.onkeyup = function () {
if (event.code == 'Digit1') {
this.but[i].classList.toggle('colY');
};
}
if (event.code == 'Digit2') {
this.but[i].classList.toggle('colY');
inp.onkeyup = function () {
if (event.code == 'Digit1') {
this.but[i].classList.toggle('colY');
};
}
}
}
}
同一个类的div元素有很多,迭代的时候,我必须在块中找到例如表示字母'h'的div,并为其分配一个新的类。
<input type="text" id="inp">
<div class="buttoN"> m</div>
<div class="buttoN">p</div>
<div class="buttoN">h</div>
<div class="buttoN">i</div>
<div class="buttoN">b</div>
.buthover{
color: red;
}
let inp = document.querySelector("#inp");
let but = document.querySelectorAll('.buttoN');
inp.onkeydown = function () {
.................
for (i = 0; i < but.length; i++) {
............................
}
}