Some Cool Tricks To Do In Python
Python is an amazing programming language, it offers great possibilities. Just them there are some cool tricks you can do in Python.
Just as a snake sheds its skin, we must shed our past over and over again.
Copied
Content
Open A Website
import webbrowser as wb
wb.open('https://aslisach.in')
This is how you can open a website with a web browser in Python.
Colored Text
from termcolor import colored
print(colored('Red Text', 'red'))
This is how you can print colored text in terminal in Python.
Shutdown
import os
os.system('shutdown -s')
This is how you can shutdown a computer using Python.
Random Number
import random
print(random.randint(0, 5))
This is how you can generate a random number in Python.
Time Delay
import time
time.sleep(2)
This is how you can you can make a time delay in python.
This is it for today but not enough, there are so many cool tricks to do with Python. I hope you guys found this article helpful. Feel free to comment below.