[Python] Python & macOS: open new Terminal window from Python, passing command to be executed

Discussão em 'Python' iniciado por Stack, Outubro 3, 2024.

  1. Stack

    Stack Membro Participativo

    I am using the following two lines of Python code to open a new Terminal window from a Python script, and this works fine:

    import os
    os.system('open -a Terminal .')


    Now I would like to pass the new Terminal window a command to be executed, for example

    ls


    How can I do that?

    Continue reading...

Compartilhe esta Página