0
須藤代碼:如何更改類如何執行功能後,類對象是完全
copying....
End of program
copy completed
:
class copy_class:
copy():
print "copying...."
subprocess(copy some large files to some location)
print "copy completed"
copy_object = class
copy_object.copy() # This function will take say, 10 minutes to complete
print "End of program"
當我運行上面的代碼,我得到類似下面的結果以便在copy_object.copy()
完成後出現「程序結束」?
我沒有使用subprocess.call(),查看源代碼,subprocess.call確實阻止了該函數,但是這是一些其他方法需要更長的時間才能執行。我想我將不得不使用隊列和線程, – user97662