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

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

Резултати

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

Пребарај: #desert

当前筛选 #desert清除筛选
厨渣爱美食

@eatNcook · Post #1526 · 19.11.2023 г., 22:02

#Desert Iced Fudge Brownies 22p 342kcal/p Brownie 240g butter 360g semi-sweet chocolate 200g sugar 1tbsp vanilla extract 1tbsp instant coffee granules 4 L eggs room temperature 62.5g all-purpose flour 43g cocoa powder 1tsp baking powder CHOCOLATE ICING 110g butter, at room temperature 360g powdered sugar 43g cocoa powder 2tsp vanilla extract 60g warmed milk sprinkles, for decorating (opt) Instructions 1. 9×13 inch pan w/paper 2. melt the butter & 3/4 chocolate chips until smooth. Stir in the sugar, vanilla, and instant coffee. 3. whisk 4 eggs, add into the chocolate mix. Add the flour, cocoa powder, and baking powder. Stir until just combined. Stir in the remaining 1/4 chocolate chips. Spread into baking pan. 175°C 28-30min. Cool. 4. make the icing. Mix the butter, powdered sugar, cocoa powder, vanilla, and 1/4 cup warm milk until smooth, adding additional warm milk until the frosting becomes thicker. Add more sugar if needed. Spread the icing over the bars. Decorate with sprinkles.

Hashtags

厨渣爱美食

@eatNcook · Post #1376 · 15.11.2023 г., 23:08

Kinder Rice Krispie bar 60g salted or unsalted butter 300g mini marshmallows 125g Rice Krispies 24 mini Kinder chocolate bars, 8 (100g) for the base, 16 (200g) for the topping Optional: Kinder halves to decorate Tin size: 8x8" #Desert

Hashtags

🎨 𝗧𝗘𝗠𝗔𝗦 𝗧𝗘𝗟𝗘𝗚𝗥𝗔𝗠 ➤ 𝗧𝗚𝗫 📢 𝗖𝗵𝗮𝗻𝗻𝗲𝗹: @DNZ_Temas ➖ ➖ ➖ ➖ ➖ ➖ ➖ ➖ ➖ ➖ 🔗𝗔𝗣𝗣𝗟𝗬 𝗧𝗛𝗘𝗠𝗘>> ✅ ⤵️𝗕𝗔𝗖𝗞𝗚𝗥𝗢𝗨𝗡𝗗>> ⬇️𝗪𝗔𝗟𝗟𝗣𝗔𝗣𝗘𝗥>> ➖ ➖ ➖ ➖ ➖ ➖ ➖ ➖ ➖ 🏷️Tags: #Blue#Desert #Landscape#MDGram ╚═══ ღ 𝔻ℕℤ 𝕋𝔼𝕄𝔸𝕊 ღ ═══╝

Interesting Planet 🌍

@interesting_planet_facts · Post #436 · 27.07.2025 г., 13:22

🌎 In Australia’s dry grasslands, the spinifex hopping mouse leaps up to 3 meters in a single bound—over 10 times its body length! Powerful back legs and long tails help it escape predators and thrive in deserts where water is scarce. ✨ #animals⚡#adaptation⚡#desert 👉subscribe Interesting Planet

123•••78
ПретходнаСтраница 1 од 8Следна