Automatically filling in answers to interactive shell command questions

Antti Kaihola akaihola at ambi-spam-me-not-tone.com
Tue Jul 22 08:48:26 CEST 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