Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
🔋The Smartphones With the Longest-Lasting Batteries
Every #smartphone users know the dilemma: It doesn’t matter how great your latest-generation smartphone is or which cutting-edge features it contains - the device still runs on old-fashioned electricity it draws from its battery, often the weakest part of the phone. With the number of apps people use and time they spend on their smartphone increasing, battery woes are all too common - the prevalence of powerbanks and charging stations popping up in different places certainly tell that story.
🦅@PerspectiveIX
📖 Read more on Statista.
🤝Support PerspectiveIX.
📱Smartphone Dominance
Following up on the poll above, although not producing the same results, here are some interesting stats from Pew Research Centre: #Smartphone users are now more likely to go online using their mobile phone than with some other type of device.
For smartphone owners, their mobile devices now outpace more traditional means of accessing the web. 46% of them say when using the internet, they mostly do so on their phone. This represents a 12% increase from 2013 when 34% of these users said this.
At the same time, the share of smartphone users who say a desktop, laptop or tablet computer is their primary device for going online has fallen from 53% in 2013 to 30% today. Roughly a quarter of smartphone users say they equally use a cellphone or a desktop, laptop or tablet computer when going online, up from 12% six years prior.
🚀@PerspectiveIX
🔈Smart Assistants Usages
According to GlobalWebIndex, that functional activities are the leading use case for #Smartphone voice assistant, like asking for directions or for checking the weather.
Home assistants, on the other hand, provide a more relaxing and interactive experience. The research also revealed that home assistant users perform a greater variety of behaviors on average, with an emphasis on content and entertainment, like streaming #Music.
🚀@PerspectiveIX via GlobalWebIndex.
❓ In the past month, have you used any Voice Assistants, such as Siri, Cortana, Alexa?
💥XIAOMI Poco C75 - Smartphone de 8+256GB
Potencia y estilo en tus manos
✅OFERTA: 98.0€
❌ Antes: 151.9€
💰Ahorras un 35%🔥
Disfruta de una pantalla fluida y cámaras de alta calidad para capturar tus mome
👉 Renueva tu smartphone ahora
#xiaomi#smartphone#tecnologia#descuentos#ofertas#viral#rebajas
🛰️Oferta publicada en Tecnología
📱Have We Reached Peak Smartphone?
After a decade of growth, the global #smartphone market came to a standstill in 2017. According to latest estimates from market research firm IDC, a worldwide total of 1,472 million #smartphones were shipped in 2017, virtually unchanged from the 1,473 million units shipped in the previous year.
🚀@PerspectiveIX
🌳https://prs.pctvix.co/2rBpZT1
Something is happening... in case it wasn’t clear...
#Smartphone#SmartWatch
🚀@PerspectiveIX
👻http://prs.pctvix.co/SnapchatIX
Do you own a Smart Watch?
👍 Yes
👎 No
📱Apple Regains the Global Best Selling Smartphone Spot
With the iPhone 8
According to Counterpoint’s Market Pulse, #Apple regained the top spot in the global best selling #smartphone list with the #iPhone 8. Seems like strong promotions (“How to shoot on iPhone”) running up to the FIFA World Cup helped the tech giant trigger buyer interest in Europe and other markets. iPhone 8 sales were steady in the US postpaid channels.
🚀@PerspectiveIX
📖 via CounterPoint: prs.pctvix.co/2zgwMrv
📑Q4 2018 Internet Report
The next billion doesn’t seem so far anymore!
Millions of people across Africa and South Asia came online for the first time in the past three months, with almost all of these new users accessing the #Internet solely via mobile devices.
- There are almost 4.2 billion internet users around the world in October 2018, up seven percent since this time last year.
- Around 3.4 billion people around the world used #SocialMedia in September 2018, up 10% since September 2017.
- More than 5.1 billion people now use a mobile phone, with most using a #smartphone.
🚀@PerspectiveIX via SlideShare (Slide Deck).