如何在模块中输出错误字符串?
主页
/
user-509155
Software Sec's questions
我写我自己的语言。我想在 vsc 中为它写我自己的语法高亮。我怎样才能做到这一点?
如何在 PyQt5 中时尚地实现这段代码?我不懂 PyQt5 也不知道怎么用。
import requests
import time
import json
ip = input('IP : ')
if ip == '':
print('[Info] Ваш ip')
response = requests.get(url=f'http://ip-api.com/json/').json()
ip = response.get('query')
else:
response = requests.get(url=f'http://ip-api.com/json/{ip}').json()
try:
data = {'[⚝ IP]': response.get('query'),'∟[Int prov]': response.get('isp'),'∟[Org]': response.get('org'),'∟[Country]': response.get('country'),'∟[Region Name]': response.get('regionName'),'∟[City]': response.get('city'),'∟[ZIP]': response.get('zip'),'∟[Lat]': response.get('lat'),'∟[Lon]': response.get('lon')}
except:
print('IP address entered incorrectly')
for k, v in data.items():
info = f'{k} : {v}' + '\n';txt = info
for i in txt: time.sleep(0.001);print(i, end= '', flush=True)
这里有一个文件**main.html**
是按钮代码。为什么它不起作用?
body {
.custom-btn {
width: 130px;
height: 40px;
color: #fff;
border-radius: 5px;
padding: 10px 25px;
font-family: 'Lato', sans-serif;
font-weight: 500;
background: transparent;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
display: inline-block;
box-shadow: inset 2px 2px 2px 0px rgba(255, 255, 255, .5), 7px 7px 20px 0px rgba(0, 0, 0, .1), 4px 4px 5px 0px rgba(0, 0, 0, .1);
outline: none;
}
.btn-9 {
border: none;
transition: all 0.3s ease;
overflow: hidden;
}
.btn-9:after {
position: absolute;
content: " ";
z-index: -1;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #1fd1f9;
background-image: linear-gradient(315deg, #1fd1f9 0%, #b621fe 74%);
transition: all 0.3s ease;
}
.btn-9:hover {
background: transparent;
box-shadow: 4px 4px 6px 0 rgba(255, 255, 255, .5), -4px -4px 6px 0 rgba(116, 125, 136, .2), inset -4px -4px 6px 0 rgba(255, 255, 255, .5), inset 4px 4px 6px 0 rgba(116, 125, 136, .3);
color: #fff;
}
.btn-9:hover:after {
-webkit-transform: scale(2) rotate(180deg);
transform: scale(2) rotate(180deg);
box-shadow: 4px 4px 6px 0 rgba(255, 255, 255, .5), -4px -4px 6px 0 rgba(116, 125, 136, .2), inset -4px -4px 6px 0 rgba(255, 255, 255, .5), inset 4px 4px 6px 0 rgba(116, 125, 136, .3);
}
<button class="custom-btn btn-9">Download</button>
如何为python脚本获取 AP 。
或者如何确保它不被盗并为自己重写?
如何保护脚本不被窥探?
如何制作自己的移动框并移除框架。
有一个窗口。但他有一个我想删除的框架。
并为移动窗口制作一个字段,但不要将其放在顶部,而是放在底部。
是否有可能做到这一点?如何?
nain.py
from tkinter import *
from tkinter import filedialog
from turtle import title
from pygame import mixer #pip install pygame
class MusicPlayer:
def __init__(self, window ):
g = 0
text = 'Pause'
window.geometry('330x110'); window.title('Это нужно убрать!'); window.resizable(0,0)
Load = Button(window, relief='flat', text = 'Load', bg = 'black', fg = 'white', width = 10, font = ('Comic', 10), command = self.load)
Play = Button(window, relief='flat', text = 'Play', bg = 'black', fg = 'white', width = 10,font = ('Comic', 10), command = self.play)
Pause = Button(window,relief='flat', text = text, bg = 'black', fg = 'white', width = 10, font = ('Comic', 10), command = self.pause)
Stop = Button(window ,relief='flat', text = 'Stop', bg = 'black', fg = 'white', width = 10, font = ('Comic', 10), command = self.stop)
Title = Label(text = 'Alis',bg = 'black', fg = 'white')
X = Button(window ,text = '×',relief='flat', bg = 'black', fg = 'white', width = 1, font = ('Times', 20), command = self.exit)
Load.place(x=0,y=20);Play.place(x=110,y=20);Pause.place(x=220,y=20);Stop.place(x=110,y=60);X.place(x=305,y=70);Title.place(x=0,y=90)
self.music_file = False
self.playing_state = False
def load(self):
self.music_file = filedialog.askopenfilename()
def play(self):
if self.music_file:
mixer.init()
mixer.music.load(self.music_file)
mixer.music.play()
def pause(self):
if not self.playing_state:
mixer.music.pause()
self.playing_state=True
self.text = 'Play'
else:
mixer.music.unpause()
self.playing_state = False
def stop(self):
mixer.music.stop()
def exit(self):
root.destroy()
root = Tk()
app= MusicPlayer(root)
root.lift()
root.wm_attributes("-topmost", True)
root.wm_attributes('-alpha',0.8)
root['bg'] = 'black'
root.mainloop()
from asyncio import sleep
from Pyrogram import Client, filters #pip install tgcrypto, pip install pyrogram
app = Client("my_account")
spam_text = 'spam'
delay = 0.25
@app.on_message(filters.command('spam', prefixes='.') & filters.me)
async def enable_spam(_, message):
await message.delete()
cmd = message.text.split()
for i in range(int(cmd[1])):
await message.reply_text(spam_text)
await sleep(delay)
app.run()
pip 没有帮助,不知道该怎么办-我安装了一个模块!-
Traceback (most recent call last):
File "c:\Users\ilyas\OneDrive\Рабочий стол\Bomber Telegram\main.py", li
ne 2, in <module>
from Pyrogram import Client, filters #pip install tgcrypto, pip insta
ll pyrogram
ModuleNotFoundError: No module named 'Pyrogram'
大家好,我怎样才能从这个代码中只获得一个 YouTube 视频的链接?在这种情况下(https://www.youtube.com/watch?v=Sl59t_OBBKc),关键是有一个链接,但我不需要其他任何东西
#pip install youtube-search-python
from youtubesearchpython import VideosSearch
channelsSearch = VideosSearch('Привет песня', limit = 1)
print(channelsSearch.result(1))
告诉我如何在Android Studio中制作一个应用程序,以便这个web应用程序将cocies存储在Android Data文件夹中。我还需要它能够正常工作,例如Spotify网站可以正常打开
大家好,有一个文件“main.py”,但是如果你把它重命名为“main1.py”,那它自然就不行了。底线是我需要 python 文件能够识别它的名称,帮我找出如何做到这一点?
我有一个 main.py 文件。但是,如果您重命名它,该文件将失去其大部分功能。
#https://sites.google.com/view/coderprogrammers/alis_version_checher
from turtle import width
import requests
from bs4 import BeautifulSoup
import json
version ='Version - 21.0.0'
url = f"https://sites.google.com/view/coderprogrammers/alis_version_checher"
req = requests.get(url)
soup = BeautifulSoup(req.text, "html.parser")
version_ACTUALITY = soup.find("div", class_="jXK9ad-SmKAyb").text
if version != version_ACTUALITY:
print('Версия устарела')
version_ACTUA = soup.find("div", class_="jXK9ad-SmKAyb").text
print(version_ACTUA)
with open ('vvvv.py', 'w', encoding='utf-8') as f:
f.write(version_ACTUA)
else:
print('Версия актуальна')
写了以下代码,我想自动更新文件,前提是它的版本不匹配,但是,当将代码写入文件时,它写了\ n作为一行而不是Enter,并且在print()中它显示同样的事情,请帮忙