Home > other > If __name__=="__main__ ': cannot use print
If __name__=="__main__ ': cannot use print
Time:09-23
Themselves to write some examples to enhance understanding of multiprocess, but ran into another problem, As follows, I intend to look at the process with wait loop method how to perform, but found that no matter how to print out, my child can normal print, is this why? I am using vscode,
If __name__=="__main__ ': P=the Process (target=f, args=(' Bob ')) M=0 While True: M +=1 Time. Sleep (1) Print (' m is % d, m) If m & gt;=40: Break P. tart () P.j oin ()
CodePudding user response:
The pritn written to the main (), is not in the try Call this, do not perform the if __name__=="__main__ '