Python: Findall Function

Post Reply
User avatar
Jason
Site Admin
Posts: 767
Joined: Sun Dec 21, 2025 8:56 pm

In this form, the findall function returns a list of instances of some phrase.

Code: Select all

import re

forum_name = str("Hosting Chatter")

instances_of_word_host_in_forum_name = re.findall("host", forum_name)

print(instances_of_word_host_in_forum_name)

# The output will be 

# ['host'] 

# due to it occuring once.
 

POSTREACT(ions) SUMMARY

Post Reply