Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в Python в модуле re.
Чтобы указать флаг для компилятора нам надо указать его после передаваемой строки. Например, добавляем флаг для игнорирования переноса строки.
pattern = re.compile(r"(\w+)+")
words = pattern.search(text, re.DOTALL)
А как указать несколько флагов? Ведь явно будут ситуации когда нам потребуется больше одного. Кто читал посты по битовые операторы уже понял как.
pattern.search(text, re.DOTALL | re.VERBOSE)
А теперь смотрим исходники, что находится в этих атрибутах?
Не удивительно, степени двойки. Почему? Потому что каждое следующее значение это сдвиг единицы влево.
>>> for n in [1, 2, 4, 8, 16, 32, 64, 128, 256]:
>>>
print(bin(n))
0b1
0b10
0b100
0b1000
0b10000
0b100000
0b1000000
0b10000000
0b100000000
Чтобы было понятней, давайте напишем тоже самое но иначе, добавим ведущие нули:
000000001
000000010
000000100
000001000
000010000
000100000
001000000
010000000
100000000
Не понятно что тут происходит? Читай три поста про битовые операторы начиная с этого ➡️https://t.me/pythonotes/45
В общем, это пример применения побитовых операций в самом Python.
Теперь вы знаете Python еще немного лучше)
#tricks#regex#libs
Croc
Easily and securely send things from one computer to another
Features
- allows any two computers to transfer data (using a relay)
- provides end-to-end encryption (using PAKE)
- enables easy cross-platform transfers (Windows, Linux, Mac, Android)
- allows multiple file transfers
- local server or port-forwarding not needed
- ipv6-first with ipv4 fallback
https://github.com/schollz/croc
https://f-droid.org/en/packages/com.github.howeyc.crocgui/
📡@NoGoolag📡@Libreware
#croc#transfer#send#share
Alt-sendme — send files and folders to anywhere in the world without storing them in the cloud — any size, any format, without accounts and restrictions.
A free file transfer tool with open source code, using the capabilities of an advanced peer-to-peer network, allowing you to transfer files directly without storing them on cloud servers.
@github
#P2P#FileTransfer#share#send#transfer
@etlgr_bot
Qué puede hacer este bot?
Obtén una dirección de correo para cualquier Chat de Telegram (grupo o usuario).
Enviar y recibir correos.
Idioma: Inglés
(visto en @BotsGram_cu)
#send, #mail, #email, #address, #welcome
@Shekelbot
Qué puede hacer este bot?
ShekelBot le ayudará a contar su dinero. Úselo, cuando le das dinero a alguien, o comparte compras.
Idioma: Inglés
(visto en @BotsGram_cu)
#money, #track, #send, #receive, #friends, #debt
@posttobot
Qué puede hacer este bot?
Este bot le ayuda a enviar un mensaje a alguien en Telegram Messenger sin usar Telegram a través de este Bot conectado con una aplicación web.
Idioma: Inglés, Ruso
(visto en @BotsGram_cu)
#web, #pc, #remote, #telegram, #message, #text, #send, #post, #bot, #dictionary
@DebtsTrackerBot
Qué puede hacer este bot?
Este bot realiza un seguimiento de sus deudas y envía recordatorios a usted y a los deudores por Telegram y SMS.
Idioma: Español, Inglés, Ruso, Italiano
(visto en @BotsGram_cu)
#friend, #money, #track, #debt, #send, #receive, #issue, #website, #request