- mport os
- s = """osascript <<EOD
- tell application "iterm"
- activate
- set myterm to (make new terminal)
- tell myterm
- launch session "Default Session"
- tell the last session
- write text "ssh [email protected]"
- delay 3
- write text "password"
- end tell
- end tell
- end tell
- EOD"""
- os.system(s)
来源: http://www.phpxs.com/code/1009104/