Ohh. Now I read the original issue more carefully (sorry!). Indeed that documentation line is wrong. .get_input_entity is intended when you're going to use the input version of something, not to just get the ID. If you just want the ID of yourself you should use client.get_me(input_peer=True).user_id instead. It should not be changed though because the method is fine, it returns an InputPeer (which might not have the ID).
if gender == "male" or "Male":
from sympy import sympify, SympifyError
def show_error(error=None):
if error is not None:
print(f'ошибка {error}')
else:
print(f'ошибка')
def calculate():
try:
print(f'result: {sympify(input("ввод: "))}')
except SympifyError:
show_error()
except NameError:
show_error()
except TypeError:
show_error()
except Exception as e:
show_error(e)
while True:
calculate()
'prodolzhit' == 'v'
prodolzhit- назовите её
cont(contunue не надо, это используется в языке).
while True:
import re
def split_by_pattern(string, pattern):
return list(filter(None, re.sub(pattern, r'@@\1', string).split('@@')))
if __name__ == '__main__':
data = '''28.03.22, ПН
08:30 - 10:00 Предмет_1
10:10 - 11:40 Предмет_2
29.03.22, ВТ
08:30 - 10:00 Предмет_1
10:10 - 11:40 Предмет_2'''
my_pattern = r'(([\d]{2}\.){2}[\d]{2})'
print(split_by_pattern(data, my_pattern))
items = [] # Пустой список
for nomination, state in btn_ass.items():
items.insert(0,MyButtons(nomination, state)) # добавляю в список
print(items[0].state)
import requests
import xlrd
from pathlib import Path
def my_xml(citype, oldname, newname):
return f'''<?xml version='1.0' encoding='UTF-8'?>
<API version='1.0' >
<citype>
<name>{citype}</name>
<criterias>
<criteria>
<parameter>
<name compOperator="IS">CI Name</name>
<value>{oldname}</value>
</parameter>
</criteria>
</criterias>
<newvalue>
<record>
<parameter>
<name>CI Name</name>
<value>{newname}</value>
</parameter>
</record>
</newvalue>
</citype>
</API>'''
if __name__ == '__main__':
datafilename = Path('data.xls')
datafilepath = Path.home() / Path('Documents/Pytest/')
datafile = datafilepath / datafilename
book = xlrd.open_workbook(datafile)
sh = book.sheet_by_index(0)
url_prefix = "http://qwerty.com/api/ci?OPERATION_NAME=update&INPUT_DATA="
for i in range(0, sh.nrows):
print(f'## Итерация номер {i} из {sh.nrows}.')
oldname = str(sh.cell_value(rowx=i, colx=0))
citype = str(sh.cell_value(rowx=i, colx=1))
newname = str(sh.cell_value(rowx=i, colx=2))
url = url_prefix + my_xml(oldname, citype, newname)
requests.post(url)
data = '''[auth][22.03 11:33:40] help
[auth][22.03 11:33:42] i'am admin
[auth][22.03 11:34:00] proceed command
[auth][22.03 11:34:04] Replied to question
[auth][22.03 11:34:05] txt
[auth][22.03 11:34:26] txt
[auth][22.03 11:34:26] Aboba
[auth][22.03 11:34:29] Replied to question
[auth][22.03 11:34:37] text'''
requested_string = 'Replied to question'
[print(line) for line in data.splitlines() if requested_string in line]
print('hello' in 'hello world')
python3 setup.py install