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

Резултати

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

Пребарај: #healthyeating

当前筛选 #healthyeating清除筛选
Green University CA | Official

@centralasian_greenuniversity · Post #344 · 13.11.2025 г., 07:44

Healthy Planet, Healthy You! ❗️Informative signs on “General Rules and Environmental Protection: Healthy Eating Habits” have been placed around the campus by psychologist Muslima Nabijonova and tutor Shokhrukh Obidov — reminding everyone that caring for nature starts with caring for ourselves #GreenUniversity#EcoLifestyle#HealthyEating#Sustainability ✉️[email protected] ☎️ +998 55 512 00 77 📍Location 🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40443 · 30.12.2025 г., 23:01

Black sapote is a fruit from Mexico and Central America. When unripe, it is hard and green. When ripe, the skin is olive-green, and the inside is soft, dark brown, and creamy like chocolate pudding. It tastes sweet and mild, like chocolate but has no bitterness or caffeine. People eat it as dessert or use it in smoothies and baking. 🍫🍃 [Source] @googlefactss#BlackSapote#TropicalFruit#HealthyEating

Dishes.Cooking.Food

@cookingdish · Post #574 · 08.11.2024 г., 15:02

Pink Pasta 🍝 Ingredients: - 300 g pasta 🍄Sauce: - 250 g cooked beetroot 🥗 - 100 g cashew nuts 🥜 - 50 ml water 💧 - 1 tbsp soy yogurt skyr 🥛 - 1 tsp oil 🫒 - 1 tsp agave syrup 🍯 - 1 tsp salt 🧂 - 1 tsp pepper 🌶️ - 1 tsp vegetable broth 🍲 Preparation: 1. 🥄 Soak the cashews in warm water for 10 minutes, then drain. Meanwhile, cook the pasta 🍲. 2. 🥢 Dice the beetroot and blend it with the other sauce ingredients until smooth. 3. 🍳 Crumble the tofu and sauté in oil, then add the beetroot and chickpeas. Fry until golden. 4. 🍝 Mix the pasta with the sauce, add your favorite toppings, and enjoy! #PinkPasta#VeganRecipe#HealthyEating @dishes

🍽️ ETHIOPIAN CUISINE: WHERE SPICE MEETS SOUL! | የኢትዮጵያ ምግቦች እና ቅመማ ቅመሞች 🫓 INJERA(እንጀራ) - THE EDIBLE PLATE: • Made from ancient grain teff (only grows in Ethiopia!) • Fermented for 3 days - creates unique spongy texture • Serves as both plate and utensil • Perfect for scooping up stews and sauces 🥘ICONIC DISHES: • Doro Wat(ዶሮ ወጥ) - spicy chicken stew (national dish) • Kitfo (ክትፎ) - Ethiopian steak tartare • Shiro (ሽሮ) - chickpea stew (vegan favorite) • Tibs (ጥብስ) - sizzling meat dishes 🤯 MIND-BLOWING FOOD FACTS: • Teff grain has MORE PROTEIN than wheat and rice combined! • Ethiopia has 200+ varieties of barley - genetic goldmine! • Injera contains probiotics - natural gut health booster • Berbere spice blend can have 20+ ingredients (family secrets!) 📰 FOOD NEWS & TRENDS: • Ethiopian restaurants opening worldwide - NYC, London, Dubai • Teff flour trending in health food stores globally • Ethiopian honey exports growing 300% (world's finest honey!) 🔥 SECRET RECIPE REVEALED: GRANDMOTHER'S HEALING BERBERE! 🌶️SECRET INGREDIENTS (serves 100+ meals): • 20 dried red chilies (Ethiopian variety) • 1 tbsp cardamom pods + 1 tsp cinnamon bark • 1 tsp black peppercorns + 1 tsp fenugreek seeds • 1 tsp coriander seeds + 1/2 tsp cloves • SECRET: 1 tsp turmeric + 1 tsp ginger powder 🔮 ANCIENT PREPARATION METHOD: 1. Toast each spice separately until fragrant 2. Grind in order of hardness (hardest first) 3. Mix while chanting traditional blessing 4. Store in dark clay pot for 7 days to "marry" flavors 🤯 GRANDMOTHER'S SECRET TIP: "Add one coffee bean while grinding - it removes bitterness and adds depth!" 💪 HEALTH BENEFITS: • Boosts metabolism by 40% • Natural antibiotic properties • Reduces inflammation ✨Expert-reviewed content | Verified by Ethiopian culinary specialist #EthiopianCuisine#BerbereSpice#TraditionalRecipes#HealthyEating#ኢትዮጵያ🇪🇹🍽️🌶️

Dishes.Cooking.Food

@cookingdish · Post #575 · 09.11.2024 г., 16:00

High Protein Wan Tan Ingredients: For the dough: - 250 g flour 🌾 - 1 tsp salt 🧂 - 100 ml warm water 💧 For the filling: - 1 cm ginger 🫚 - 100 g soy granules 🌱 - 2 spring onions 🧅 - 2 cloves of garlic 🧄 - 3 mushrooms 🍄 - 1 carrot 🥕 - 4 tbsp soy sauce 🧴 - 1 tbsp starch 🌿 Additionally: - oil for frying 🛢️ - 100 ml water for steaming 💦 #HighProtein#WanTan#HealthyEating#Vegan @dishes

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40840 · 22.03.2026 г., 07:02

Jellyfish have been eaten in Asia for centuries. People eat them in China, Japan, and Southeast Asia. They are processed with salt and alum to remove water and make them crunchy. Only certain species are safe to eat. Jellyfish are low in calories and high in protein. The processing tightens proteins, giving them a firm, crunchy texture. They are often served in salads, cold dishes, or as a crunchy snack. 🦑🥗🍴 [Read more] @googlefactss #JellyfishFood#AsianCuisine#SeafoodFacts#HealthyEating#FoodHistory

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40500 · 08.01.2026 г., 11:02

To ripen avocados fast, put them in a brown paper bag with an apple or banana. These fruits release a gas called ethylene that helps avocados ripen quicker, usually in 1 to 3 days. Keep the bag at room temperature and check daily. Avoid the fridge until they are ripe, or they won’t ripen properly. 🥑🍌🍎@googlefactss #AvocadoRipening#FastRipen#KitchenTips#FruitRipening#HealthyEating

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40478 · 04.01.2026 г., 23:01

Cold weather and frost make many vegetables sweeter by increasing their sugar. Collards survive down to -9°C (15°F), beets down to -7°C (20°F), and both grow well if planted in late summer. Frost may damage some leaves but helps roots taste better. Cover plants with row covers if it gets colder than -7°C (20°F) to protect them. 🌿❄️ @googlefactss #WinterVeggies#FrostSweetened#ColdHardy#GardeningTips#HealthyEating

Dishes.Cooking.Food

@cookingdish · Post #787 · 28.03.2025 г., 14:04

High Protein Vegetable Patties 🥕 Ingredients: - 1 small carrot 🥕 - 1 medium potato 🥔 - 1/2 bell pepper 🌶 - 1 onion 🧅 - 50 g soy granules 🌱 - 50 g corn 🌽 - 50 ml water 💧 - 100 g flour 🌾 - 1 tbsp starch ✨ - Oil for frying 🍳 Preparation: 1️⃣ Grate the carrot & potato, dice the pepper & onion, and place in a bowl 🥣 2️⃣ Soak the soybean granules in water, then add to the bowl along with the remaining ingredients and mix well 👩‍🍳 3️⃣ Shape the dough into patties and sauté in a pan with a little oil until golden brown 🥘 Enjoy! 😋 #HighProtein#VegetablePatties#VeganRecipe#HealthyEating#PlantBased @dishes

Dishes.Cooking.Food

@cookingdish · Post #583 · 17.11.2024 г., 15:23

High Protein Vegetable Patties 🥕 Ingredients: - 1 small carrot 🥕 - 1 medium potato 🥔 - 1/2 bell pepper 🌶️ - 1 onion 🧅 - 50 g soy granules 🌱 - 50 g corn 🌽 - 50 ml water 💧 - 100 g flour 🌾 - 1 tbsp starch ✨ - Oil for frying 🍳 Preparation: 1️⃣ Grate the carrot & potato, dice the pepper & onion, and place in a bowl 🥣 2️⃣ Soak the soybean granules in water, then add to the bowl along with the remaining ingredients and mix well 👩‍🍳 3️⃣ Shape the dough into patties and sauté in a pan with a little oil until golden brown 🥘 Enjoy! 😋 #HighProtein#VegetablePatties#VeganRecipe#HealthyEating#PlantBased @dishes

Dishes.Cooking.Food

@cookingdish · Post #572 · 06.11.2024 г., 14:37

🥞High Protein Cereal Pancakes 🥞 Ingredients: 🌾 160g flour 🥛 360 ml almond drink 💪 1 tbsp protein powder (optional) ✨ 1 tsp baking powder 🍯 1 tbsp agave syrup 🍏 2 tbsp apple cider vinegar Toppings: 🥝 5 mini kiwis 🥥 200 ml plant-based drink 🌴 1 tsp date syrup 🍒 Pomegranate seeds Preparation: 1️⃣ Mix all ingredients for the pancakes. 2️⃣ Fry a thumb-sized portion of dough over medium heat with a little oil. 3️⃣ Enjoy with your delicious toppings! 😋 --- #HealthyEating#HighProteinPancakes#VeganBreakfast#PancakeLovers@dishes @dishes

ПретходнаСтраница 1 од 3Следна