TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #22 · 19 јан.

Заметка начинающим, которые часто сталкиваются с подобной непоняткой. Ситуация следующая, есть список файлов: 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

Hashtags

Резултати

Пронајдени 4 слични објави

Пребарај: #oxygenos

当前筛选 #oxygenos清除筛选
Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #731 · 14.04.2026 г., 11:56

Oxygen OS - Port | Android 16 | Nothing Phone (2) ✍️Details: - Based On: OxygenOS 16.0.3 (Base Oneplus 12R) - Version: 1.2.0 - Codename: #Pong - Build date: 14/04/26 🔽 Chnangelog & Download:Here ❌ Known Issues: Here 🔖 Tags: #OxygenOS#Port ⚠️ Notes - SELinux is Permissive. - FW is included, do not flash again! - Root: The shipped kernel is rooted with KSU (KernelSU) by default. - Kernels: Custom kernels are NOT supported. - This build uses a non-secure crypto engine implementation. Any passwords set for privacy features (such as app lock, app hiding, or file vault) can be easily bypassed by simply deleting the associated storage files. Do not rely on it for real security or for protecting sensitive personal data. Special Thanks to @Superuser1958 and @GhostRX89! 👤 Maintainers : @CyberPhantom52 | @El_pong 💬 Chat: @NothingPhone2 🔔 Updates: @NothingPhone2Updates

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #728 · 10.04.2026 г., 14:52

Oxygen OS - Port | Android 16 | Nothing Phone (2) ✍️Details: - Based On: OxygenOS 16.0.3 (Base Oneplus 12R) - Version: 1.1.0 - Codename: #Pong - Build date: 23/03/26 🔽 Cnangelog & Download:Here ❌ Known Issues: Here 🔖 Tags: #OxygenOS#Port ⚠️ Notes - SELinux is Permissive. - Root: The shipped kernel is rooted with KSU (KernelSU) by default. - Kernels: Custom kernels are NOT supported. - Encryption: Storage is NOT encrypted. A Format Data is mandatory if you are currently encrypted. - This build uses a non-secure crypto engine implementation. Any passwords set for privacy features (such as app lock, app hiding, or file vault) can be easily bypassed by simply deleting the associated storage files. Do not rely on it for real security or for protecting sensitive personal data. Special Thanks to @Superuser1958 and @GhostRX89 👤 Maintainers : @CyberPhantom52 | @El_pong 💬 Chat: @NothingPhone2 🔔 Updates: @NothingPhone2Updates

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #723 · 23.03.2026 г., 07:20

Oxygen OS - Port | Android 16 | Nothing Phone (2) ✍️Details: - Version: 16.0.3 RC.1 (Base Oneplus 12R) - Codename: #Pong - Build date: 23/03/26 🔽 Download:Here 💰 Changelogs & Flashing: Here ❌ Known Issues: Here 🔖 Tags: #OxygenOS#Port ⚠️ Notes - SELinux is Permissive. - Root: The shipped kernel is rooted with KSU (KernelSU) by default. - Kernels: Custom kernels are NOT supported. - Encryption: Storage is NOT encrypted. A Format Data is mandatory if you are currently encrypted. - FOD Brightness Limitation: The fingerprint scanner will only register successfully when your screen brightness is manually set to at least 70%. Will be fixed in a future release. - This build uses a NON-secure cryptoeng implementation. Any password protection can be trivially bypassed by deleting the storage files. Use this only to get the features working; do not rely on it for actual security or storing sensitive personal data. 👤 Maintainers : @CyberPhantom52 | @El_pong 💬 Chat: @NothingPhone2 🔔 Updates: @NothingPhone2Updates

Oneplus 13 Updates

@OnePlus13Series · Post #341 · 13.11.2025 г., 15:50

OnePlus 13 Specifications Codename: dodge cc: TechleaksZone • 6.82" (3168×1440 px) 2K+ BOE X2 LTPO AMOLED display • 1-120Hz variable refresh rate • 4500nits peak brightness • 2160Hz PWM Dimming • Dolby Vision; 1.07 billion colors • Crystal Shield glass protection • Snapdragon 8 Elite SoC • LPDDR5X RAM; UFS 4.0 storage • 9925mm² VC chamber • 50MP main (LYT-T 808, OIS) • 50MP Ultrawide (JN5); 2.5cm macro • 50MP 3X Telephoto (LYT-600; OIS) • 120X Digital Zoom; Hassleblad camera • 32MP Front camera • AAC CSA+ 0916 X-axis linear motor (volume 602mm³) • Goodix Ultrasonic fingerprint • IR Blaster; Alert Slider • Dust & water resistant (IP68 + IP69) • Stereo speakers, OReality & OHaptics • 6000mAh battery; USB-C 3.2 Gen 1 • 100W wired (Max 6.0A at 10V) + 50W wireless charging (Upto 18W PD - IN variant) •4 AndroidOS upgrades + 6yrs Security Patches. (Android 15 OOB) •Lifetime Display Warranty for greenline concerns (For India) @OnePlus13Series | @OnePlus13SeriesChatRoom #oneplus13#specs#oxygenos