import telebotimport telebot as telegramfrom multiprocessing import Process
...
if __name__ == '__main__':
while True:
processes = []
processes.append(Process(target=main, args=('https://rust.tm/item/5358808098-0-Shipping%20Container%20Garage%20Door/', 'Shipping Container Garage Door', 60)))
processes.append(Process(target=main, args=('https://rust.tm/item/5518269987-0-Abyss%20Vest/', 'Abyss Vest', 140)))
processes.append(Process(target=main, args=('https://rust.tm/item/4136069987-0-Weather%20Large%20Wood%20Box/', 'Weather Large Wood Box', 100)))
for process in processes:
process.start()
for process in processes:
process.join()
time.sleep(5) # Задержка перед следующим циклом import telebot
class ExceptionHandler(telebot.ExceptionHandler):
def handle(self, exception):
print('Ооооошибка 409!:', exception)
return True
bot = telebot.TeleBot('YOUR_API_TOKEN', exception_handler=ExceptionHandler())
bot.polling(none_stop=True) with_extra_data=True в свою самописную функцию, а в parser.get_flats() - нет. Соответственно он и не парсит дополнительные поля, отсюда и: "пробовала вывести ключи: смотрю, а их там тупо нет". data = parser.get_flats(deal_type=deal_type, rooms=rooms, with_extra_data=True, additional_settings={"start_page": page, "end_page": page})<span> c текстом "Тип жилья", а именно такой селектор использовался в библиотеке парсера, следовательно он всегда будет отдавать -1 для object_type.__parse_flat_offer_page_json__(self)после инициализации словаря page_data, добавить: ot = self.offer_page_soup.select_one('[data-name="OfferSummaryInfoItem"] p:nth-of-type(2)').get_text()
page_data["object_type"] = ot# if "Тип жилья" == span.text:
# page_data["object_type"] = spans[index + 1].text
=VLOOKUP(A1;'Лист2'!$A$1:$B$5;2)=VLOOKUP(запрос; диапазон; индекс)
import wx
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.SetSize((250, 250))
self.SetTitle("frame")
sizer_1 = wx.WrapSizer(wx.VERTICAL)
fields = [
("Ширина (м)", "a"),
("Длина (м)", "b"),
("Высота (м)", "h"),
("Окно ширина (м)", "o1"),
("Окно высота (м)", "o2"),
("Дверь ширина (м)", "d1"),
("Дверь высота (м)", "d2"),
]
# Create grid sizers and controls dynamically
for label_text, attr in fields:
grid_sizer = wx.GridSizer(1, 2, 0, 0)
sizer_1.Add(grid_sizer, 1, wx.EXPAND, 0)
label = wx.StaticText(self, wx.ID_ANY, label_text)
grid_sizer.Add(label, 0, wx.ALL, 1)
text_ctrl = wx.TextCtrl(self, wx.ID_ANY, "")
setattr(self, attr, text_ctrl) # Store the text control in the instance
grid_sizer.Add(text_ctrl, 0, 0, 0)
# Create a horizontal sizer for the result and button
h_sizer = wx.BoxSizer(wx.HORIZONTAL)
# Result text control
self.itogo = wx.TextCtrl(self, wx.ID_ANY, "")
self.itogo.SetBackgroundColour((171, 171, 171))
h_sizer.Add(self.itogo, 1, wx.EXPAND | wx.ALL, 5)
# Calculate button
self.button_1 = wx.Button(self, wx.ID_ANY, "Посчитать", size=(110, 21))
h_sizer.Add(self.button_1, 0, wx.ALL, 5)
self.button_1.Bind(wx.EVT_BUTTON, self.onclick)
# Add the horizontal sizer to the main sizer
sizer_1.Add(h_sizer, 0, wx.EXPAND, 0)
self.SetSizer(sizer_1)
self.Layout()
def onclick(self, event):
a = float(self.a.GetValue())
b = float(self.b.GetValue())
h = float(self.h.GetValue())
o1 = float(self.o1.GetValue())
o2 = float(self.o2.GetValue())
d1 = float(self.d1.GetValue())
d2 = float(self.d2.GetValue())
result = round(a * 2 * h + b * 2 * h - o1 * o2 - d1 * d2, 2)
self.itogo.SetValue(str(result))
class MyApp(wx.App):
def OnInit(self):
self.frame = MyFrame(None, wx.ID_ANY, "")
self.SetTopWindow(self.frame)
self.frame.Show()
return True
if __name__ == "__main__":
app = MyApp(0)
app.MainLoop()r перед ф-строкой во избежание нескольких invalid escape sequence:command = rf'C:\PsTools\psexec.exe -i 1 -s \\192.168.11.18 -u user -p password calc.exe'import subprocess
def f():
command = rf'C:\Portable\Sysinternal\PsExec.exe -i 1 -s \\192.168.0.3 -u user -p password calc.exe'
return subprocess.call(command, stdout=subprocess.DEVNULL)interactive=True, надо указать номер сессии (можно узнать через cmd -> query user), например: interactive_session=1. Это аналог -i 1 в psexec.c.run_executable (executable: "cmd.exe", arguments=r"/c start calc.exe", interactive=True, interactive_session=1) num_1 = None
num_2 = None
effect = None
while True:
if num_1 is None:
input_value = input("Введите первое число: ")
if input_value.isdigit():
num_1 = int(input_value)
else:
print('Вы ввели не число!')
continue
if num_2 is None:
input_value = input("Введите второе число: ")
if input_value.isdigit():
num_2 = int(input_value)
else:
print('Вы ввели не число!')
continue
if effect is None:
input_value = input(
"Напишите что вы хотите сделать (отнять, прибавить, умножить, разделить, возвести в степень, целое деление, остаток от деления): ")
if input_value in ("+", "-", "*", "/", "**", "//", "%"):
effect = input_value
break
else:
print('Нету такого действия!')
continue
# Выполнение операции
if effect == "+":
print(num_1 + num_2)
elif effect == "-":
print(num_1 - num_2)
elif effect == "*":
print(num_1 * num_2)
elif effect == "/":
print(num_1 / num_2)
elif effect == "**":
print(num_1 ** num_2)
elif effect == "//":
print(num_1 // num_2)
elif effect == "%":
print(num_1 % num_2) config.getint("User", "id") возвращает тип int, а у данного типа нет метода (атрибута) 'send'.user_id.send("Ваша заявка была одобрена") вызовет ошибку выше.user = await bot.fetch_user(user_id: int)
await user.send(message) import torch
torch.cuda.is_available()device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print(device)
model = MyModel(args)
model.to(device)l = []
for i in range(3):
l.append(lambda: i)
print([f() for f in l])
>>> [2, 2, 2]l = []
for i in range(3):
l.append(lambda i = i : i)
print([f() for f in l])
>>> [0, 1, 2]while True:
try:
x = pa.locateCenterOnScreen(r"C:\Python Scripts\library\proga.png", confidence=0.5)
print(x)
except Exception as e:
print(e)