Horje
how to use regex in a list Code Example
how to use regex in a list
# list filtering with regex
import re
l = ['...', 'ram', 'karan','..','......', '....']

pattern = re.compile("\.\.+")
lst = [x for x in l if not re.match(pattern, x)]
print(lst)

# output 
['ram', 'karan']




Python

Related
python sorting array without inbuilt sort Code Example python sorting array without inbuilt sort Code Example
python sorted dictionary multiple keys Code Example python sorted dictionary multiple keys Code Example
arch linux python 3.7 Code Example arch linux python 3.7 Code Example
anaconda virtual environment LIST Code Example anaconda virtual environment LIST Code Example
isinstance float or int Code Example isinstance float or int Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7