@sgmrt · Post #1567 · 14.12.2022 г., 04:29
[EWL] UPDATE: Train svc btwn #GulCircle and #Lakeside have resumed. Free regular bus and free bridging bus btwn #GulCircle and #Lakeside have ceased. - SMRT
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #309 · 2 фев.
Метод строки 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
Пребарај: #lakeside
@sgmrt · Post #1567 · 14.12.2022 г., 04:29
[EWL] UPDATE: Train svc btwn #GulCircle and #Lakeside have resumed. Free regular bus and free bridging bus btwn #GulCircle and #Lakeside have ceased. - SMRT
Hashtags
@sgmrt · Post #1566 · 14.12.2022 г., 04:15
[EWL] UPDATE: Train svc btwn #GulCircle and #Lakeside have resumed. Free regular bus & free bridging bus is still available btwn #GulCircle and #Lakeside. - SMRT
Hashtags
@sgmrt · Post #1565 · 14.12.2022 г., 04:15
[EWL] UPDATE: Train svc btwn #GulCircle and #Lakeside have resumed. Free regular bus is still available btwn #GulCircle and #Lakeside. Free bridging bus ceased. - SMRT
Hashtags
@sgmrt · Post #1564 · 14.12.2022 г., 03:32
[EWL]: Due to a signalling fault, there is no train svc btwn #GulCircle and #Lakeside. Free regular bus and free bus bridging is available btwn #GulCircle and #Lakeside. - SMRT
Hashtags
@sgmrt · Post #2304 · 04.04.2025 г., 07:39
[EWL] UPDATE: Due to a track fault, please expect an additional 20 mins of travelling time between #Queenstown and #BoonLay. Shuttle train is available between #JurongEast and #Lakeside. Please look out for fellow commuters in need and give a helping hand. We apologise for - SMRT
@sgmrt · Post #2303 · 04.04.2025 г., 07:39
[EWL] UPDATE: Due to a track fault, please expect an additional 20 mins of travelling time between #Queenstown and #BoonLay. Shuttle train is available between #JurongEast and #Lakeside. Please look out for fellow commuters in need and give a helping hand. We apologise for https://bit.ly/3Rz4KwF - SMRT
@sgmrt · Post #2299 · 04.04.2025 г., 06:54
[EWL] UPDATE: Due to a track fault, please expect an additional 20mins of travelling time between #Queenstown and #BoonLay. Shuttle train is available between #JurongEast and #Lakeside. Free regular bus is available between #BuonaVista and #BoonLay. If you have any enquiries, - SMRT
@sgmrt · Post #2297 · 04.04.2025 г., 06:24
[EWL] UPDATE: Due to a track fault, please expect an additional 20mins of travelling time between #Queenstown and #BoonLay. Shuttle train is available between #JurongEast and #Lakeside. Free regular bus is available between #BuonaVista and #BoonLay. Train service is still - SMRT
@sgmrt · Post #2294 · 04.04.2025 г., 05:39
[EWL]: Due to a track fault, please expect an additional 20mins of travelling time between #Queenstown and #BoonLay. Shuttle train is available between #JurongEast and #Lakeside. Free regular bus is available between #BuonaVista and #BoonLay. - SMRT
@sgmrt · Post #2293 · 04.04.2025 г., 05:34
[EWL]: Due to a track fault, please expect an additional 20mins of travelling time between #Queenstown and #BoonLay. Shuttle train are available between #Clementi and #JurongEast and #JurongEast and #Lakeside. Free regular bus is available between #BuonaVista and #BoonLay. - SMRT