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

TGINSIGHT SIMILAR POSTS

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

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

Ранее мы уже говорили о том, как выполнить какой-либо код перед открытием интерактивной консоли. Расскажу еще один способ! На самом деле, даже запустив интерпретатор в обычном режиме с выполнением скрипта из файла вы можете в любом месте активировать интерактивный режим. Или даже несколько по очереди. За это отвечает модуль code. Как это может пригодиться? 🔸 Вам не хватает pdb и хочется больше "власти" 🔸 Нужно запросить у юзера данные в достаточно сложном виде. В этом случае можно попросить его создать что ему надо и сохранить в определённую переменную, с которой потом и работать. 🔸 Нужна изолированная среда для выполнения каких-либо действий. 🔸 Просто забавы ради😁 Запускается консоль очень просто import code ic = code.InteractiveConsole() try: ic.interact() except SystemExit: pass Выход обратно на предыдущий уровень происходит как обычно, вызов функции exit() или клавиши Ctrl+D(Ctrl+Z для Windows). Я набросал простой пример с некоторым функционалом 🔹 Меняются символы приглашения 🔹 В неймспейсы добавляются дополнительные объекты 🔹 Считается время, проведённое в интерактивном режиме 🔹 Скрипт просит юзера заполнить переменную и по выходу распечатывает её значение Код здесь ↗️ Для запуска сохраните код в файл и запускайте как обычный скрипт. python my_console.py Для быстрого запуска можно сделать отдельный алиас alias py="python3 /home/username/my_console.py" #tricks#source

Резултати

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

Пребарај: #paste

当前筛选 #paste清除筛选
Dishes.Cooking.Food

@cookingdish · Post #936 · 28.08.2025 г., 13:01

🍂Pumpkin Pasta!🍝 Ingredients: * 2 Pumpkins * 1 head Garlic * 1 tsp dry Oregano * 1 tbsp Paprika * 4 sprigs fresh Thyme * 1 sprig Sage * Olive oil * Pasta (of your choice) * Salt & Pepper, to taste * 1 Shallot * 1/3 cup White dry wine * 1 cup heavy Cream * 100 g. Parmigiano Reggiano #paste @dishes

Hashtags

Dishes.Cooking.Food

@cookingdish · Post #477 · 13.08.2024 г., 13:01

Caramelized Onion Pasta Ingredients: Oven: *300 g shallots *300 g vegan cream cheese *60 ml maple syrup *200 g smoked tofu *salt and pepper *Oil as desired Aside from that: *350g pasta *200 g dried tomatoes *1 bunch of fresh wild garlic *60 ml pasta water #paste @dishes

Hashtags

Dishes.Cooking.Food

@cookingdish · Post #475 · 11.08.2024 г., 13:02

Rice Noodle Spring Salad Ingredients: *1 carrot *100 g fresh red cabbage *1/2 cucumber *1/2 red onion *1 mango *250 g rice noodles Peanut sauce: *2 cm ginger *2 cloves of garlic *200 g peanut butter *20 ml sesame oil *50 ml maple syrup *50 ml soy sauce *150ml water Toppings: Chili flakes Coriander, mint peanuts #paste @dishes

Hashtags

Dishes.Cooking.Food

@cookingdish · Post #471 · 07.08.2024 г., 15:03

Roasted Vegetables Pasta Ingredients: *2 peppers *12 cherry tomatoes *150 g mushrooms *3 onions *6 cloves of garlic *1/2 zucchini Marinade: *Oil as desired *1 tsp chili *1 tsp salt *1 tbsp paprika *1 tbsp oregano *1 tbsp thyme *Price pepper Sauce: *200 g vegan cream cheese *82 tbsp tomato paste *2 handfuls of fresh basil *2 tbsp pasta water *1 tbsp balsamic vinegar Topping: *Pine nuts, roasted *Parmesan, vegan *Basil, fresh #paste @dishes

Hashtags

Dishes.Cooking.Food

@cookingdish · Post #459 · 28.07.2024 г., 15:48

You Need To Taste This Green Goddess Salad With Watermelon & Pasta Ingredients: *200 grams of watermelon *100 grams of cucumber *200 grams of pasta Dressing: *80 grams of spinach *1/2 bunch basil *1 clove of garlic *1/2 onion *50 grams of peas *40ml oil *25ml water *1 tbsp vinegar *1 tsp salt *40 grams of walnuts *juice of a lemon *1 tbsp yeast flakes *pinch of pepper toppings: Walnuts, Basil, Chili Flakes #paste @dishes

Hashtags

Dishes.Cooking.Food

@cookingdish · Post #406 · 12.06.2024 г., 13:01

Creamy Salmon Pasta Ingredients: *2 steaks of Salmon *50g. Butter *1 Shallot Onion *2 Fresh garlic cloves *1 1/2 Cup Cream. Heavy cream/whipping cream. *Fresh Dill or Parsley *1/2 TspLemon zest *Dry white Wine *Salt and black pepper. *Pasta Penne #paste @dishes

Hashtags

Dishes.Cooking.Food

@cookingdish · Post #397 · 07.06.2024 г., 12:59

Pasta Alla Vodka with Pancetta🧀 Ingredients: *350g. Rigatoni pasta (Can be replaced with penne pasta) *2 Tbsp Olive oil *150g. diced Pancetta *2 Shallot onion, finely chopped *3 Garlic cloves, finely chopped *1/2 Tsp Red-Chilli flakes *1/2 Tsp dried Oregano *1/2 cup Vodka *1 cup Tomato sauce *1/4 cup Tomato paste with basil pesto *2 cup Heavy cream *1/4 cup Parmesan cheese, plus more for serving *1 tablespoon roughly chopped fresh Basil *2 tablespoons roughly chopped Italian Parsley #paste @dishes

Hashtags

Dishes.Cooking.Food

@cookingdish · Post #349 · 13.04.2024 г., 16:59

PASTA WITH SHALLOTS & HERBS!🍝🌱 Ingredients: * Pasta * 1 cup Heavy cream * ¾ cup Parmesan cheese * 2 Shallots * 4 cloves Garlic * ¼ cup White wine * 4 tbsp Olive oil * 1 tbsp Butter * Fresh parsley * Chives * Salt/Pepper #paste @dishes

Hashtags

Dishes.Cooking.Food

@cookingdish · Post #341 · 06.04.2024 г., 12:04

ROASTED RED PEPPER PASTA! 🌶️ Ingredients: * 400 g. Giant Fusilli Pasta * 4 Red Bell Peppers * 2 Shallot onion * 1 head Garlic * Olive oil * 1 cup Heavy Cream * Red chili flakes * Italian herbs * 1 tbsp Tomato paste * 1 tbsp Butter * Salt/Pepper #paste @dishes

Hashtags

Dishes.Cooking.Food

@cookingdish · Post #339 · 03.04.2024 г., 12:05

AVOCADO SPINACH PASTA! ✨🥑 Ingredients: * 2 cloves Garlic * 1 Avocado * 130 g. Spinach * 50 g. Roasted pine nuts * Olive oil * Lemon juice * 100 ml. Water * Vegan parmesan * Cherry tomatoes * Salt/Pepper #paste @dishes

Hashtags

Dishes.Cooking.Food

@cookingdish · Post #335 · 31.03.2024 г., 14:19

ALFREDO RIGATONI! ✨ Ingredients: * Rigatoni * Shallot * Mushrooms * Garlic * Olive oil * White wine * Butter * Salt/Pepper * Cream * Fresh parsley * Parmesan cheese #paste @dishes

Hashtags

Dishes.Cooking.Food

@cookingdish · Post #318 · 19.03.2024 г., 15:00

KALE PASTA! 🍝 Ingredients: * 250 g. Pasta * 3 handfuls Kale * 1 Red onion * 3 cloves Garlic * Olive oil * 2 tbsp Tomato paste * Lemon juice * 400 ml. Vegan cream * Salt/Pepper * Vegan parmesan * Chili flakes #paste @dishes

Hashtags

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