Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
News: Finance Minister calls for nationwide #fuel conservation as gov’t considers further restrictions
#Ethiopia’s Finance Minister, #Ahmed_Shide, has urged consumers across the country to use fuel “with high conservation,” warning that additional measures aimed at curbing fuel consumption are currently under study.
The call came as the Ministry of Finance announced a new adjustment to domestic #petroleum prices, increasing fuel costs by up to 10 Birr per liter while warning that legal action has begun against entities accused of selling subsidized fuel above government-mandated prices.
In a briefing to journalists, Ahmed said the government is reminding all fuel users to exercise strict conservation. “We want to remind all fuel users that they must use fuel with high conservation,” he said, adding that additional measures currently under review will be announced to the public in the near future.
According to the ministry, the revised prices ……
Read more: https://addisstandard.com/?p=55769
News: #US. issues temporary waiver for #Iranian oil shipments already in transit
The Office of Foreign Assets Control (#OFAC) has issued a time-limited authorization allowing the delivery and sale of Iranian-origin crude oil and #petroleum products that were already loaded onto vessels before 20 March 2026.
In a notice released under “General License U,” the office, part of the U.S. Department of the Treasury, said transactions ordinarily prohibited under U.S. sanctions will be permitted if they are “incident and necessary” to the completion of shipments already in transit by the cutoff date.
The authorization allows activities including the sale, transport, and offloading of such cargoes until 19 April 2026, after which the standard sanctions regime resumes in full.
The measure does not lift broader sanctions on Iran but provides a narrow window to conclude pre-existing .....
https://www.facebook.com/AddisstandardEng/posts/pfbid046J7SQDcCLbGA4CpsTCDV5PcRKReRmpZrNkVZnsMQWdtrvsYjWwsQyaGK5gvfDRvl
NNPC Secures $1 Billion Investment
The Nigerian National Petroleum Corporation (NNPC) is set for a major funding round of $1 billion scheduled for December 17, 2024. For more details, visit their official page at NNPC LTD.
#NNPC#Investment#Funding#Oil#Petroleum#Nigeria#Energy#Finance#CorporateNews#December2024#BillionDollarRound
Funding Rounds Update: December 2024
Recent funding announcements highlight significant investments across various industries:
- ATC Managers, LLC: $14M on Dec 19, 2024 - Nationwide private lender.
- Boon: $15.5M on Dec 20, 2024 - AI solutions provider.
- Accelergen Energy: $20M on Dec 19, 2024 - Clean power asset management.
- Backflip AI: $30M on Dec 19, 2024 - AI content creation.
- Justt: $30M on Dec 19, 2024 - Chargeback automation.
- Decart: $32M on Dec 19, 2024 - Consumer AI platform.
- Instant Transport Solution: $35M on Dec 20, 2024 - Transportation technology.
- TBC Bank Uzbekistan: $37M on Dec 20, 2024 - Banking services.
- RiverWoods Exeter: $39.68M on Dec 18, 2024 - Retirement community.
- EPTME: $44M on Dec 16, 2024 - Lifestyle management.
- JET Charge: $44.93M on Dec 19, 2024 - EV charging solutions.
- Pasadena Private Lending: $50M on Dec 19, 2024 - Non-bank lending.
- Earli: $60M on Dec 19, 2024 - Cancer early detection.
- ALLO: $100M on Dec 19, 2024 - Real-world asset trading.
- DP World Group: $100M on Dec 19, 2024 - Logistics management.
- InoBat: $103.62M on Dec 20, 2024 - Sustainable battery production.
- ŌURA: $200M on Nov 19, 2024 - Health monitoring technology.
- Metsä Group: $208.40M on Dec 19, 2024 - Renewable products.
- Collectivus Holdings: $250M on Dec 19, 2024 - Investment management.
- Nigerian National Petroleum Corporation (NNPC): $1B on Dec 17, 2024 - Petroleum services.
#Funding#Investment#AI#Lending#Logistics#CleanEnergy#HealthTech#Batteries#ConsumerAI#EV#Retirement#Finance#Cancer#Sustainability#Transport#Renewables#RealEstate#Tech#NonBank#Petroleum#Automation