Closed. This question needs to be more focused。它当前不接受答案。
想改善这个问题吗?更新问题,使其仅通过editing this post专注于一个问题。
2年前关闭。
如何编写自动测试以检查vi编辑器是否可以使用Python正确编程?
python大神给出的解决方案
保存包含vi命令的脚本,如下所示。
cat script.sh
vi abc.txt <<INPUT
i
Line 1
Line 2
^[
ZZ
INPUT
使用python subprocess.check_call检查执行状态
subprocess.check_call(["script.sh" , "arg1"])
这将运行带有参数的命令(script.sh)(如果需要)。等待命令完成。如果返回码为零,则返回,
否则引发CalledProcessError Exception
。
Closed. This question needs details or clarity。它当前不接受答案。 …
mkvirtualenv命令是什么意思?是Linux命令还是python命令..? [关闭] - pythonClosed. This question is off-topic。它当前不接受答案。 …
有什么方法可以远程发出telnet命令并重复两次telnet会话? [关闭] - pythonIt's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current fo…
Python sqlite3数据库已锁定 - python我在Windows上使用Python 3和sqlite3。我正在开发一个使用数据库存储联系人的小型应用程序。我注意到,如果应用程序被强制关闭(通过错误或通过任务管理器结束),则会收到sqlite3错误(sqlite3.OperationalError:数据库已锁定)。我想这是因为在应用程序关闭之前,我没有正确关闭数据库连接。我已经试过了: connectio…
在当前目录下编写一个脚本,生成多个目录,创建空文件,然后列出所有文件。 - pythonClosed. This question needs details or clarity。它当前不接受答案。 …