第1个回答 2020-03-12
import subprocessimport sys ret = subprocess.check_call(['ls', '-l'])if ret != 0: # something wrong! To deal with the exception sys.exit(ret) ret = subprocess.check_call(['rm', '-f', 'file_to_delete'])if ret != 0: # similar to the above #......