Mar-25-2024, 04:43 PM
import re vid_set = set(("apple", "apple2e", "banana", "banana2", "cherry", "cherry2")) print({x for x in vid_set if re.search(r"\d", x)})
Output:{'banana2', 'apple2e', 'cherry2'}
If a set element has digits in the element
|
|
Messages In This Thread |
If a set element has digits in the element - by tester_V - Mar-25-2024, 04:34 AM
RE: If a set element has digits in the element - by tester_V - Mar-25-2024, 05:10 AM
RE: If a set element has digits in the element - by Gribouillis - Mar-25-2024, 07:36 AM
RE: If a set element has digits in the element - by deanhystad - Mar-25-2024, 04:43 PM
|