Remove specific values from the list

Asked 2 years ago, Updated 2 years ago, 15 views

Hi, how are you?

df = ["Ga", "Na", 0", [0, "Da", "La", [Ma", 0, "B"]]

There is a list like this, but here, remove the 0 value and

new_df = ["Ga", "Na", ["Da", "La", ["Ma", "Ba"]]

I want to write it like this Is there any possible way?

python

2022-09-22 13:32

1 Answers

If you look at the structure first, there is a list in the list. I think there's a function in the list function that says remove. ex) a = ['1', '2', '3'] If you say a.remove(3), a=['1', '2' But we need to make an exception, right?


2022-09-22 13:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.