Automatically filling in answers to interactive shell command questions

Antti Kaihola akaihola at ambi-spam-me-not-tone.com
Tue Jul 22 02:48:26 EDT 2003


>     >>> import os
>     >>> outf = os.popen('addperson', 'w')
>     >>> inf = file('answer_file', 'r')
>     >>> outf.write(inf.read())
>     >>> inf.close()
>     >>> outf.close()

Would this work:

import os, shutil
shutil.copyfileobj(file('answer_file'), os.popen('addperson', 'w'))





More information about the Python-list mailing list