[Django]-TypeError: f0() takes 1 positional argument but 9 were given

8👍

You are passing in a single string as the args value:

args=(i)

That’s not a tuple, that’s a grouped expression containing just 'hello.com', an iterable with 9 separate elements (single-character strings).

Add a comma; tuples are formed by the comma, not the parentheses (although you need parentheses to disambiguate the tuple from other arguments in a call):

args=(i,)

or if you find that confusing, use a list:

args=[i]

0👍

In ‘args=(i)’, (i) is not a tuple.
Convert (i) into a tuple by appending , so the right statement will be:
t1=thread.Thread(target=f0,args=(i,))

👤Fred

Leave a comment