Class 参数变量自动以逗号分隔,

Class argument variable automatically comma separated,

你好,

我将下面的变量传递给 class

中的函数

ba4dfb43-46a6-44ec-9249-18bdf6621b01

但是当我在 class 中调用它时,它是用逗号分隔的。像下面的格式。

('b', 'a', '4', 'd', 'f', 'b', '4', '3', '- ', '2', '8', '7', '5', '-', '4', 'b', '8', 'd', '-', 'b', 'a', '5', 'd', '-', '1', '8', 'b', 'd', 'f', '6 ', '6', '2', '1', 'b', '0', '1', '\n')

谁能告诉我为什么会这样?

for item in run_list: print('item passing to processes1') print(item) # item is printing properly here and type is str p1 = Process(target=runclass.crowdstrike, args=(item))

Class代码如下

# ========================== Main Class ============================= class VolumesParallel(object): # ============================= Multiprocessing CS CODE ====================================== def strike(self, *item): print('inside the class') print(item)

将 item 传递给 args 时需要逗号。在 python 中,如果在圆括号内有一项,则它不是元组,它只是括号内的一项。所以你让它像元组一样你需要在 item

之后添加一个逗号