# объявлено переменную challenge_packeth_header, и присвоил ей ссылку на байтовую строку
challenge_packeth_header = b'\xff\xff\xff\xff\x73\x0a'
# объявлено переменную challenge, и присвоил ей ссылку на рандомное число от 0 к 2 к 32 степени -1
challenge = random.randint(0, 2**32-1)
# создаем переменную packet которая ссылается на тот же объект что и challenge_packet_header
packet = challenge_packet_header
packet += pack('I', challenge) # пакуем байты, присваиваем packet значение packet + упакованные байты
self.sock.sendto(packet, addr) # отправляем обьект, на который ссылается переменная packet по адресу addr
import vk_api
vk_session = vk_api.VkApi('+71234567890', 'mypassword')
vk_session.auth()
vk = vk_session.get_api()
posts = vk.wall.get(count=100)['items']
while(posts):
for post in posts:
print(post['id'])
vk.wall.delete(post_id=post['id'])
posts = vk.wall.get(count=100)['items']
owner_id = -29246653
post_id = 184828
await client.send_message(message.channel, 'USD: ' + str(btc_price_usd) + ' | RUB: ' + str(btc_price_rub))
await channel.send()
channel = message.channel
await channel.send("Куприв")
async def btcprice(ctx):
channel = ctx.channel
print('[command]: btcprice ')
btc_price_usd, btc_price_rub = get_btc_price()
await channel.send('USD: ' + str(btc_price_usd) + ' | RUB: ' + str(btc_price_rub))
from pywinauto.application import Application
app = Application().connect(title_re="Telegram")
app.window(title_re='Telegram \(\d+\)').set_focus()
hwnd = win32gui.FindWindow(None,"Telegram")
win32gui.ShowWindow(hwnd, win32con.SW_NORMAL)
win32gui.SetForegroundWindow(hwnd)
from lxml import etree
xml = '''ВАШ XML'''
parser = etree.XMLParser(
encoding='utf-8',
recover=True,
)
root = etree.fromstring(xml.encode(), parser=parser)
address = root.xpath('.//address')[0].get('addr')
cpe = root.xpath('.//cpe')
for im in cpe:
print(f'{address} : {im.text}')
print(f'{address} : {cpe[0].text}')
file (File) – The file to upload.
files (List[File]) – A list of files to upload. Must be a maximum of 10.
with open('source.txt', 'r') as source, open('result.txt', 'w') as result_file:
lines = source.readlines()
result = ', '.join(f'"{x}": "{y}"' for x, y in zip(*lines))
result_file.write(result)
import json
# ... тут помещаем нашу строку в переменную s, например в цикле.
s = '2020.08.31-14.15.33: {"P1":{"Location1":{"X": 266225.40625,"Y": 501808.46875,"Z": 21883.58984375},"CLocation1":{"X": 266225.40625,"Y": 501808.46875,"Z": 21883.58984375},"Event": false,"ProfileName": "Player","UserId": "76561198968409999","HasImmortality": false},"P2":{"Location2":{"X": 265164.625,"Y": 499088.78125,"Z": 22396.548828125},"CLocation2":{"X": 265164.21875,"Y": 499089,"Z": 22396.548828125},"Event": false,"ProfileName": "player2","UserId": "76561197996445700"},"Weapon": "AKM","TimeOfDay": "15:17:20"}'
# теперь извлекаем
players = json.loads(s.split(':', 1)[1].strip())
for index in ('P1', 'P2'):
player = players[index]
profile_name = players[index]['ProfileName']
user_id=players[index]["UserId"]
print(f'{index} {profile_name} ({user_id})')
f_read = open("тест.txt", "r")
last_line = f_read.readlines()[-1]
print(last_line)