Метод строки split() разделяет строку на несколько строк по указанному символу
>>> "a_b_c".split('_')
['a', 'b', 'c']
Можно указать максимальное количество разделений
>>> "a_b_c".split('_', 1)
['a', 'b_c']
Или резать с другой стороны с помощью rsplit() (right split)
>>> "a_b_c".rsplit('_', 1)
['a_b', 'c']
А что будет если оставить аргументы пустыми?
>>> "a_b_c".split()
['a_b_c']
Получаем список с одним элементом, потому что по умолчанию используется пробельный символ.
>>> "a b c".split()
['a', 'b', 'c']
То есть это равнозначно такому вызову?
>>> "a b c".split(" ")
['a', 'b', 'c']
Кажется да, но нет! Давайте попробуем добавить пробелов между буквами
>>> "a b c".split(" ")
['a', '', '', 'b', '', '', 'c']
И вот картина уже не так предсказуема 😕
А вот что будет по умолчанию
>>> "a b c".split()
['a', 'b', 'c']
Всё снова красиво! 🤩
По умолчанию в качестве разделителя используется любой пробельный символ, будь то табуляция или новая строка. Включая несколько таких символов идущих подряд. А также игнорируются пробельные символы по краям строки.
>>> "a\t b\n c ".split()
['a', 'b', 'c']
Аналогичный способ можно собрать с помощью регулярного выражения. Но пробелы по краям строки придется обрабатывать дополнительно.
>>> import re
>>> re.split(r"\s+", ' a b c '.strip())
['a', 'b', 'c']
Здесь тоже можно указать количество разделений
>>> re.split(r"\s+", 'a b c', 1)
['a', 'b c']
А что если мы хотим написать красиво, то есть split() без аргументов, но при этом указать количество разделений? В этом случае первым аргументом передаём None
>>> "a\n b c".split(None, 1)
['a', 'b c']
Данный метод не учитывает строки с пробелами, взятые в кавычки
'a "b c" '.split()
['a', '"b', 'c"']
Но для таких случаев есть другие способы.
#tricks#basic
#microg Release v0.3.7.250923
https://github.com/microg/GmsCore/releases/tag/v0.3.7.250932
New Features and changes:
Work Profile
You can now sign into various work accounts that setup a work profile when using microG. As microG does not comply with all functionality imposed by organization administrators, you need to enable this feature manually in microG Settings > Work profile. Together with this comes functionality to view and install apps suggested by the organization administrator through the Play Store.
Play Feature Delivery
Apps can request installation of additional languages or features from split packages. You can activate this from microG Settings > Play Store
Face detection
This release ships with initial support for Google's Face Detection API. This functionality is still very incomplete, but works for some apps using it.
Changelog
Maps: Various fixes for HMS Maps (#2737, #2754, #2778, #2825). Thanks @DaVinci9196.
Vision: Improve Barcode Scanning APIs (#2735, #2787). Thanks @DaVinci9196.
Vision: Add initial support for face detection API (#2793). Thanks @DaVinci9196.
Location: Add support for moving WiFis in Eurostar trains (#2821). Thanks @TimoWilken.
Fitness: Add dummy for Recording API (#2760). Thanks @DaVinci9196.
Auth: Various fixes for quick login and third-party Google sign-in (#2660, #2698, #2798). Thanks @DaVinci9196.
Auth: Add support for work accounts (#2553). Thanks @fynngodau.
DroidGuard: Disable access to hardware attestation.
Vending: Fix handling of IAP for multi-account setups (#2681). Thanks @DaVinci9196.
Vending: Add work app store (#2553). Thanks @fynngodau.
Vending: Disable access to hardware keys for play integrity (#2740). Thanks @DaVinci9196
Vending: Add dummys (#2759, #2791). Thanks @DaVinci9196.
Various fixes to improve support for Google Apps (#2652, #2654, #2684, #2738, #2767, #2779, #2780). Thanks @DaVinci9196.
Various fixes for dynamic links (#2662), Fido (#2811), SmsRetriever API (#2786), AppSet dummy (#2781), web view handling (#2836, #2862). Thanks @DaVinci9196, @ale5000-git.
Version bumps (#2813, #2829). Thanks @DaVinci9196, @ale5000-git
String and location infrastructure fixes (#2693, #2755, #2781). Thanks @lucasmz-dev, @Fs00.
New/Updated translations
FakeGAppsmicroG InstallerStableRelease(v1.6)
* Updated #microG to v0.3.2.240913
* Fixed Google Maps crash
* Fixed location settings crash
* Uninstaller is now available
* See latest microG setup here.
🏆 Thanks for @nift4 for UnifiedNLP overlay.
✅ Get it from https://fakegapps.github.io
💬 Join us @FakeGAppsChat
#microg v0.2.28.231657
https://github.com/microg/GmsCore/releases/tag/v0.2.28.231657
Changelog
Entirely new, rewritten location stack
Major update to maps implementation. Thanks fynngodau
Support for reCAPTCHA Enterprise API
Various compatibility improvements
Notes
The new location stack does not support UnifiedNlp modules anymore. This was a step necessary to take to get locations properly working on latest Android versions. This means that some features previously available through UnifiedNlp modules do no longer exist. The goal is to merge the most important of those features into GmsCore. For now, the new locations stack is relying exclusively on Mozilla Location Service for network based location.
microG GmsCore now requests a few additional privileged permissions. As always, privileged permissions are optional for microG and you can continue using microG as an unprivileged app with only minor downsides. The new privileged permissions are:
android.permission.LOCATION_HARDWARE
android.permission.MODIFY_PHONE_STATE
android.permission.NETWORK_SCAN
android.permission.UPDATE_DEVICE_STATS
android.permission.WATCH_APPOPS
Be careful for #MicroG users: Current version is NOT secure for login with your Google Account. It will show your email/password in cleartext in logcat.
It doesn't matter if you have root or not, you only need logcat access to exploit it.
Check the issue here
https://github.com/microg/GmsCore/issues/1567