platform.system()
でスクリプトを実行しているOSを確認して,シェルにosascript -e 'display notification "hoge"'
を投げる.macOSならplatform.system()
は'Darwin'
がかえってくる.
import os,platform
def main():
if platform.system() == 'Darwin':
os.system("osascript -e 'display notification \"これはMacです\"'")
if __name__ == '__main__':
main()
参考にしたもの: