+ 3

re.findall() vs str.count()

Could you please tell me whats the advantages/disadvantages of these methods which seem to give similar results.

23rd Dec 2019, 6:48 PM
Егор гордеев
Егор гордеев - avatar
2 ответов
+ 4
str.count() counts the instances of a certain string while re.findall() returns all matches. Might seem silly and useless but is helpful when you're doing RegEx matches.
24th Dec 2019, 12:34 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
Thank you, friend!
23rd Dec 2019, 9:24 PM
Егор гордеев
Егор гордеев - avatar