'Extracting the content of a tag depending its attribute value with beautiful soup

I have a tree with two tags like this :

<orgName>This is the full name of the organisation</orgName>

<orgName type="acronym">Nickname</orgName>

To get the full name I can write something like:

FullName=w.orgName.string (where w is a parent)

But How can I get "Nickname" without confusion with the full name ?

FullName=w.orgName(type="acronym")

does not work... Thanks for your help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source