Jaydeb Bhunia
Jaydeb Bhunia

Reputation: 29

how to find out a specific text from a long text in python

I have a long text. how to get only "Brandshubs" from below HTML?

output = Brandshubs3.7

Upvotes: 0

Views: 127

Answers (2)

nexus6
nexus6

Reputation: 26

Just use re.search('Brandshubs', s) or findall function in python re library. But you will get the string Brandshubs always, that's not meaningful so I guess you want to check exists or count the times? For that you can check/count the results of these functions' return directly

Upvotes: 1

Victor
Victor

Reputation: 428

You can use either text.find("Brandshubs") or utilize the Python re library if you need something more sophisticated.

Upvotes: 1

Related Questions