battery.py
Show laptop battery status
#!/usr/bin/env python3
now = 0
full = 0
with open('/sys/class/power_supply/BAT1/energy_now') as fp:
now = float(fp.read())
with open('/sys/class/power_supply/BAT1/energy_full') as fp:
full = float(fp.read())
per = str(int(now * 100/ full))
print(per + "%")