我正在尝试编写一个程序来运行一些带有模拟用户数据的 shell 命令。
问题是,如果代码末尾没有这一行,shell 命令将无法正确运行:
raw_input('press <enter> to exit')
我怎样才能摆脱那条线?
child = pexpect.spawn('grunt init:gruntfile')
child.logfile_read = sys.stdout
child.expect ('Is the DOM involved in ANY way?')
child.sendline ('y')
child.logfile_read = sys.stdout
child.expect ('Will files be concatenated or minified?')
child.sendline ('y')
child.logfile_read = sys.stdout
child.expect ('Will you have a package.json file?')
child.sendline ('y')
child.logfile_read = sys.stdout
child.expect ('Do you need to make any changes to the above before continuing?')
child.sendline ('n')
child.logfile_read = sys.stdout
raw_input('press <enter> to exit')