Заметка начинающим, которые часто сталкиваются с подобной непоняткой.
Ситуация следующая, есть список файлов:
names = [
'image.bmp',
'second.txt.bkp',
'data.db',
'.config.cfg',
'file.ext.bkp'
]
И мы хотим убрать у них окончание ".bkp".
Не знаю зачем, пример довольно надуманный) Но суть он показывает, а это главное.
Те, кто еще не очень знаком с библиотекой os.path или pathlib, вероятно решат обработать имена как строки. И тут вполне подойдет метод строки strip().
Что делает этот метод? Он отрезает указанные символы по обеим сторонам строки. Если ничего не указать, то убирает невидимые символы (пробелы, табуляции и переносы строк).
В нашем случае будет выглядеть вот так:
>>> name.strip('.bkp')
То есть просим удалить строку '.bkp' по краям имени файла, если таковая есть.
Можно применить аналогичный метод rstrip(), чтобы отрезать только справа, но для этого примера используем обычный.
>>> for name in names:
>>> print(name.strip('.bkp'))
image.bm
second.txt
data.d
config.cfg
file.ext
Хм, что-то не то с нашими именами! Что случилось??? Видим нежелательное переименование в именах, где и близко не было указанной строки '.bkp'
А дело всё в том, что данный метод ищет не указанную строку, а указанные символы, и не важно в каком порядке.
Для метода strip() строка '.bkp' это не паттерн для поискаа список символов. Потому он отрезал симовол 'p' от '.bmp' и удалил точку из файла '.config.cfg'.
Как тогда правильно заменить именно паттерн? Для начинающего можно посоветовать метод строки replace(), который как раз использует для замены указанную строку целиком. В нашем примере заменим её на пустую строку.
>>> for name in names:
>>> print(name.replace('.bkp', ''))
image.bmp
second.txt
data.db
.config.cfg
file.ext
Уже лучше, но помните, это лишь пример про strip(). Для работы с именами файлов есть способы и более "правильные", дающие однозначно верный результат. Я взял файлы только в качестве примера. Даже replase() тут может сделать не то что ожидаем.
Просто впредь будьте внимательны с этим strip().
#basic
Hello everyone ! Long time without an announcement from your favorite frenchie (@Onelots)
As you know, we try to be as transparent as possible with you.
That's why today we decided to tell you how much money goes in and goes out the project.
As you probably know, about 1 year ago (May 2025) we moved from the "classic" rom scheme (every maintainer builds and send his zips on source forge) to a new one, using a dedicated server to build for all the devices, and cloudflare's content delivery network to provide you the builds as fast as possible all around the world.
This system had many advantages, such as :
- Fast releases (the server is huge)
- Consistent releases (since the sources are always the same as for the other devices on the server)
- Way more security : No one has the signing keys anymore, only the server.
But all this has a cost, and we felt like the community deserved to know what costs how much.
This "1 year period" is the one I used to do this table : From May 2025 to April 2026.
🔊 Please note : We are not begging for money! It's quite the opposite, actually. This message is there to thank you for your support. As you will see in the image below, the people who supported us really helped us to keep the ROM alive.
I'm obviously open to the discussion if anyone has a question about the table I sent. Just ping me and I'll be happy to reply !
#KeepEvolving#EvolutionX
#EvolutionX#UNOFFICIAL#A15#diting
EvolutionX 10.7 | UNOFFICIAL | Android 15
Updated: 29/6/2025
▪️Download: Gdrive | Mirror
▪️Screenshots
▪️Support
Changelogs:
• Sync last source
• Voip volume control problem fixed
• All new infinityx features have been added
• Optimized things for better performance
• Xiaomi camera Support
• Added Sony dolby
• KSU Support
WARNING
It is necessary to clean flash
Credits:Here
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat
#EvolutionX#UNOFFICIAL#A15#diting
EvolutionX 10.7 | UNOFFICIAL | Android 15
Updated: 4/6/2025
▪️Download: Gdrive | Mirror
▪️Screenshots
Changelogs:
• June 2025 security patches have been merged into our Android 15 QPR2 branch. The latest version is now 10.7. As a reminder, all related Play integrity spoofing in the ROM have been removed already. All reports regarding certification failing will be ignored
• Switched to Yuki kernel oss
• kernel is now compiled with yuki clang 21 optimized by klozz
• Has the visual bug of negative battery percentage been fixed?
• The entire tree has been overrun. performance has been optimized and improved, such as micro lag.
• New thermal system
• Override doze mode support
• Remove wifilearner HIDL entry from manifest
• and other internal changes
• Add support for spatial audio
• Xiaomi camera Support
• Dolby audio by default
• KSU Support
CLEAN FLASH MANDATORY
Credits:Here
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat
#EvolutionX#UNOFFICIAL#A15#diting
EvolutionX 10.6 | UNOFFICIAL | Android 15
Updated: 31/5/2025
▪️Download: Gdrive | Mirror
▪️Screenshots
▪️Support
Changelogs:
• Sync last source from evox
• sepolicy: Allow fingerprint hal to read system dmabuf device
• switch to common AIDL IR service
• HBM removed and display saturation
• And other minor changes
• Rebase Xiaomi Parts
• Xiaomi camera Support
• KSU Support
Credits:
@TeamMEX_XDA
@ArianK16a
@Omar99A
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat
#EvolutionX#UNOFFICIAL#A15#diting
EvolutionX 10.3.1 | UNOFFICIAL | Android 15
Updated: 20/3/2025
▪️Download: here
▪️Screenshots
▪️KSU
Changelogs:
• Added FEAS support
• Fingerprint fixes, not sure if this fixes fingerprint issues for some users.
• March security patch updated
• Sync last source
• Integrity passed
Notes:
• QPR2 is not yet ready by the evolution working group. So we still have to wait.
Credits:
Thanks to @Mohammadnt96 and @TeamMEX_XDA
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat
#EvolutionX#UNOFFICIAL#A15#diting
EvolutionX 10.3 | UNOFFICIAL | Android 15
Updated: 6/3/2025
▪️Download: here
▪️Screenshots
Changelogs:
• March patches are now available in Google source. However, it seems this is A15 QPR2 with all the changes made. We will be waiting for LineageOS this time before merging anything as it's sure to break a lot of the current code we have.
Credits:
Thanks to @Mohammadnt96 and @TeamMEX_XDA
By@Jezzay97 | Donate
Follow@xiaomi_12tpro_updates
Join@xiaomi12tpro_chat