N
N
NOblo2020-06-23 14:21:21
Python
NOblo, 2020-06-23 14:21:21

Crooked list, how to fix?

There is such a thing: And here is the question, how is this ugliness (it was so distorted due to the database) Turn it into such a normal list with numbers that can be used normally?: At the same time, I cannot know how many values ​​are in the "list" and what they are values. How to make a normal list? You are welcome
A = [(70,),(179,),(819)]
A = 70,179,819

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2020-06-23
@sergey-gornostaev

a = [j for i in A if isinstance(i, tuple) for j in i]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question