#!/usr/bin/env python3
import os
import sys
import glob
batteries = glob.glob('/sys/class/power_supply/BAT*')
if not any(os.path.isdir(b) for b in batteries):
    print("None")
    sys.exit(1)
first = True
for battery in glob.glob('/sys/class/power_supply/BAT?*'):
    try:
        with open(os.path.join(battery, "capacity")) as f:
            capacity = int(f.read().strip())
    except Exception:
        capacity = 0
    if not first:
        print(" ", end="")
    print(f"{capacity}%", end="")
    first = False

print()
