Python – Remove Non-English characters Strings from List
Given a List of Strings, perform removal of all Strings with non-english characters.
Input : test_list = [‘Good| ????’, ‘??Geeks???’] Output :  Explanation : Both contain non-English characters Input : test_list = [“Gfg”, “Best”] Output : [“Gfg”, “Best”] Explanation : Both are valid English words.
Method #1 : Using regex + findall() + list comprehension
In this, we create a regex of unicodes and check for occurrence in String List, extract each String without unicode using findall().
Method #2 : Using regex + search() + filter() + lambda
In this, we search for only English alphabets in String, and extract only those that have those. We use filter() + lambda to perform the task of passing filter functionality and iteration.
The Time and Space Complexity for all the methods are the same:
Time Complexity: O(n)
Auxiliary Space: O(n)
Method #3 : Using for loop
The original list is : ['Gfg', 'Good| ????', 'for', '??Geeks???'] The extracted list : ['Gfg', 'Good', 'for', 'Geeks']