import psutil percent = psutil.sensors_battery().percent full_charge = 100 indicator_len = 4 result = int((percent / full_charge) * indicator_len) print('🟩' * result, f'{percent} %') # example result # 🟩🟩🟩 76 %
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter