pexpectとは https://pexpect.readthedocs.io/en/stable/ 対話式のコマンドを自動化するために使われる、expectというコマンドのPython版です。 expectは昔からある有名なコマンドぽいですが、tclという言語を使わなければならず大変とてもつらいので、python実装をできれば使いたい。そんなとこです。 pexpectの問題 しかしここで問題になるのがpythonなこと。 そもそもすべてのコマンドが対話なわけでなく、基本的には普通にコマンドを並べて、たまにpexpectしたい場合、そこだけpythonの別ファイルにしなければならず、別ファイルになって見通しが悪くなったり、引数を渡してあげたりしなきゃいけません。 xonshだと下みたいにかけます。便利。 (適当な例なのでchpasswdは投げつけないでください…) ということでpexpe