How to distinguish "Android" from other "Linux" operating systems in Python? -
i'm running python script on phone through qpython. title pretty much explains question. need check if script running on android device. i've tried os.name, sys.platform , platform.system() homecoming various kinds of "linux" or "posix", not specific plenty (as far know - maybe missing relevant info here).
i considered trying import android module, , utilize success or failure of determine if os android. don't need android module though, seems bit excessive.
you can check 'android_storage' in environ:
>>> os import environ >>> is_android = 'android_storage' in environ >>> is_android true android python
No comments:
Post a Comment