python input EOFError: EOF when reading a line

代码如下

  1 from multiprocessing import Process
  2 
  3 def test():
  4     print("----我是子进程-----")
  5     num = input("请输入内容:")
  6     print(num)
  7 
  8 print("-----主进程-----")
  9 p = Process(target=test)
 10 p.start()
 11 p.join()
 12 
 13 print("-----end------")

运行结果
Python input EOFError:EOF when reading a line

出错原因

python规定只能在父进程里面用input,在子进程里面调用input会报该错误

相关文章:

  • 2021-11-14
  • 2022-12-23
  • 2021-07-06
  • 2021-07-31
  • 2022-12-23
  • 2021-11-15
  • 2022-12-23
  • 2021-11-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案