Hello everyone,
As the topic suggest we are going to create python output that would be
simple output in an bold form itself inside python shell.
Install pip install prompt-toolkit first
Lets get on with the code:-
#pip install prompt-toolkit >>> from __future__ import unicode_literals, print_function >>> from prompt_toolkit import print_formatted_text, HTML >>> string = "Hello World Welcome to Python 4 Fun" >>> print_formatted_text(HTML(f'<b>{string}</b>')) Hello World Welcome to Python 4 Fun
I have tried all types method to make the output Bold.
But this method only works only on Windows in Python Shell.
But in Python IDLE the same code will throw an error
So how to run this?
Simple, Create PY file as bold.py and from CMD run it as python "bold.py".
Run > CMD > python "bold.py"
You can also run as batch file.
i.e. open Notepad > python "bold.py" (Type & save it as Runpy.bat)
Double click on the Runpy.bat file and it will work but for a split second.
To stop it from disappearing add pause
This is how a batch file should look like
== Runpy.bat =================
@echo off
python "bold.py"
pause
===========================
Hope you like the tutorial.
Python is simple and fun to play with and yet very powerful. 🔥
Comments
Post a Comment