1

In a shell, I can execute AppleScript command-line code like so:

osascript -e "tell application \"Finder\" to activate"

Is the same thing possible in Python, e.g.:

python --execute "print('hello world!')"
miguelmorin
  • 5,025
  • 4
  • 29
  • 64
  • 1
    `man python` will point you in the right direction. – xrisk Nov 18 '20 at 12:44
  • 3
    Does this answer your question? [How to execute Python inline from a bash shell](https://stackoverflow.com/questions/16908236/how-to-execute-python-inline-from-a-bash-shell) – wakey Nov 18 '20 at 12:46

1 Answers1

3

Something like this should work for you!

python -c 'print("Hi")'

Probably a duplicate of How to execute Python inline from a bash shell

wakey
  • 2,283
  • 4
  • 31
  • 58