Home > front end >  Class argument variable automatically comma separated,
Class argument variable automatically comma separated,

Time:04-10

Hi,

I'm passing below variable to a function inside a class

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

but when I call it inside the class it is comma separated. like below format.

('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')

Can someone tell me why it is happening?

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 code is follows

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

CodePudding user response:

You need a comma when you passing item to args. In python if have one item inside circle brckets, it is not a tuple, it is just item inside brackets. So tu make it like tuple you need to add a comma after item

  • Related