
Python
- 80 ответов
- 0 вопросов
66
Вклад в тег
>>> help(set)
Python 3.10.5 (main, Aug 1 2022, 07:53:20) [GCC 12.1.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: set?
Init signature: set(self, /, *args, **kwargs)
Docstring:
set() -> new empty set object
set(iterable) -> new set object
Build an unordered collection of unique elements.
Type: type
Subclasses:
In [2]: %pdef set
No definition header found for set
In [3]: %pdoc set
Class docstring:
set() -> new empty set object
set(iterable) -> new set object
Build an unordered collection of unique elements.
Init docstring:
Initialize self. See help(type(self)) for accurate signature.
In [4]: %psource set
No source found for set
from pyrogram import Client
from pyrogram import types, filters
CHANNEL_ID = -11012345678
app = Client(
"my_account",
api_id=12345,
api_hash="0123456789abcdef0123456789abcdef"
)
@app.on_message(filters=filters.channel)
def my_handler(client: Client, message: types.Message):
if message.chat.id != CHANNEL_ID:
return
print("Получено новое сообщение с ID", message.message_id)
# Как-то обработать сообщение с канала, например, напечатать его текст
print("Текст:", message.text)
app.run()
@app.on_message(filters=filters.channel & ~filters.edited)
import re
s = "новая версия вчера - version1"
r = re.search(r'[a-zA-Z]{7}\d', s)
print(r.group())