String arguments in python multiprocessing

前端 未结 3 498
生来不讨喜
生来不讨喜 2021-02-01 01:54

I\'m trying to pass a string argument to a target function in a process. Somehow, the string is interpreted as a list of as many arguments as there are characters.

This

3条回答
  •  日久生厌
    2021-02-01 02:31

    You have to pass

    p = multiprocessing.Process(target=write, args=('hello',))
    

    Notice the comma! Otherwise it is interpreted as a simple string and not as a 1 element tuple.

提交回复
热议问题