I need help i know your all experts but i am learner

list=[1,2,3,4,[],5,6,[],7,8,9]
output[1,2,3,4,5,6,7,8,9] need to remove []

Assuming you only want integers in the result.
Python code:

ans = []
for x in list_original:
    if type(x) == int:
        ans.append(x)
3 Likes

thank you very much :slightly_smiling_face:

You may use list comprehension in python for this:

PROGRAM:
list=[1,2,3,4,[],5,6,[],7,8,9]
list=[x for x in list if x!=[]]
print(list)

1 Like

Thank you very much :slightly_smiling_face:

list=[1,2,3,4,5,6,7,8,1,2,3] Duplicates need to remove in simple way please help

I found a Beautiful Article online about this, for me the most simplest one was:
li = [1,2,3,4,5,6,7,8,1,2,3]
li = list(set(li))
print(li)
The link to the article is here : https://favtutor.com/blogs/remove-duplicates-from-list-python ENJOY :smile:

1 Like

Thank you very much :slightly_smiling_face: bro