Created
April 9, 2019 23:29
-
-
Save tatesuke/c3854a0cd299e8ae3b391e8a425639ad to your computer and use it in GitHub Desktop.
pythonでPC充電状態を判定
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pip install psutil | |
| # sbattery(percent=100, secsleft=<BatteryTime.POWER_TIME_UNLIMITED: -2>, power_plugged=True) | |
| # sbattery(percent=100, secsleft=4294967295, power_plugged=False) | |
| import psutil | |
| battery = psutil.sensors_battery() | |
| print(battery.power_plugged) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment