Ранее мы уже говорили о том, как выполнить какой-либо код перед открытием интерактивной консоли.
Расскажу еще один способ! На самом деле, даже запустив интерпретатор в обычном режиме с выполнением скрипта из файла вы можете в любом месте активировать интерактивный режим. Или даже несколько по очереди. За это отвечает модуль 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
✨ Airdrop Cryptal (FCFS)
💸 Rewards :- VIBE Tokens
👉 Airdrop Link :- https://cryptal.ai/sign-up?ref=0WDAWL1IWC
➖ Log in with your Twitter account
➖ Complete all tasks of the airdrop
➖ Check daily and get more Points
#Note :- VIBE Credits will be converted into VIBE tokens after TGE #Cryptal#InfoFi#Vibecredits hurry up
📰 Tonso AI – Final 3 Campaigns: What Their Latest Updates Actually Mean for You
1. @try_limitless
12000$ $limitless for campaign
#limitless
2. @GetYieldFi
EDEN boost still running hard on yPRISM vault: 38.8k EDEN/day until March 3 + base tokenized yield (~5.7% APY + YF Points).
TVL > $11.6M and growing.
Why it matters: Double-dip opportunity (EDEN + vault yield) with only ~8 days left. Simple “why I’m adding now” posts get strong replies and quality Buzz.
3. @multiplifi
New highlight: Over $3B credit lines backed by tokenized gold → targeting Middle East gold/equity/RWA markets.
Borrow against assets without selling.
Why it matters: Real liquidity unlock in a dip. Posts on “tokenized gold as collateral = no forced sales” spark serious discussion & mindshare.
These three are the only live ones left. Cysic ZK makes every good post count more (provable impact).
Pick one whose latest update actually excites you — post something real about it (your take, personal angle, quick breakdown) while time remains.
Which update feels most relevant to you right now?
Tria’s TradFi call-out? YieldFi’s EDEN boost? Multipli’s tokenized gold push?
Comment below 👇
#TonsoAI#Tria#GetYieldFi#MultipliFi#InfoFi
Crypto Twitter Buzzes Over Kaito.ai
Crypto Twitter is abuzz with excitement around *kaito.ai*, a promising new player in the InfoFi space. After a revealing conversation with *Kaito.ai* CEO Yu Hu and notable investors like Sequoia and Dragonfly, awareness of the platform skyrocketed after the launch of ChatGPT, significantly boosting *Kaito.ai*'s valuation. Plans for collaboration with early user support are underway, enhancing insights for the platform. Additionally, JP Morgan's unexpected $100 million investment in strategy shares after buying Bitcoin emphasizes shifting perspectives on crypto, showcasing that actions may speak louder than words in the financial world. Meanwhile, a dramatic 500 ETH (approx. $1.5M) was burned with a mysterious message, indicating internal disputes within *Kuande Investment*. Stay tuned for further updates! Read more here
#Crypto#KaitoAI#InfoFi#Bitcoin#JP Morgan #USD#ETH#Burn#Investment#WhaleAlert#AI#Tech#Market#Finance#Sequoia#Dragonfly#Earnings#Meme#Trends#Analytics