Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在执行 cmd B 和 cmd C 时记录一些信息。我的想法是,在cmd B和cmd C启动之前执行cmd A(cmd A是记录信息),然后在cmd B和cmd C完成时暂停cmd A。如何实现?
您可以从 cmdA 函数运行 cmdB 和 cmdC 函数。
def cmdB(): pass def cmdC(): pass def cmdA(): # start recording information print "recording started" #run cmdB cmdB() # run cmdC cmdC() # stop recording print "recording stopped" if __name__ == '__main__': cmdA()