• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Remove multiple elements from list using regex matching

Resolved: Remove multiple elements from list using regex matching

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I have an excel workbook that has sheet names as Countries. Along with those sheets, there are additional sheets that I do not want to process. Hence I am trying to eliminate those sheets and keep only the sheets where sheet names are country names.
Below is the code I am using and it is getting the job done:
Output:
Since I am using 4 statements just to gather the names of the sheets to be removed, I was hoping to find a more concise way to do the same task.

Answer:

It seems fine what you have in my opinion. Another option is to check for each sheet name if this name contains one of your words. If not, keep it in a list:

If you have better answer, please add a comment about this, thank you!

list list-comprehension pandas python
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: significance letter above bar graphic in wrong order

01/04/2023

Resolved: VBA – Applying border around the areas with value/text

01/04/2023

Resolved: How can I implement a function depending on picked up items?

01/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.