Answer the question
In order to leave comments, you need to log in
Can only concatenate list (not "str") to list. What is the problem?
I made a bot, it was necessary to convert a two-dimensional list into a one-dimensional one . I
used:
def combing_list(self, task:list):
result = sum(task, [])
return result
users = self.combing_list(users)
Answer the question
In order to leave comments, you need to log in
What's on the list?
For your code to work, task must be not just a list, but a list of lists. If there is a line in it, then you will get exactly this error.
Heaps , it might be easier to use itertools.chain.from_iterable() to solve your problem .
What do you want to achieve? If you add lists, then use append/extend.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question