I know this is the basic.
I’m just wondering what is the elegant way to do it.
For example:
I want the the ‘python01.wav’ and ‘py*thon’ strings from this list
The list is like this:
[
[('name', 'entry')],
[('class', 'entry')],
[('type', 'text/javascript'), ('src', '/term_added.php?hw=python')],
[('type', 'text/javascript')],
[('class', 'headword')],
[('class', 'hw')],
[],
[('class', 'pr')],
[('class', 'unicode')],
[('class', 'unicode')],
[('class', 'unicode')],
[('class', 'unicode')],
[],
[('href', '#'), ('onclick', "playAudio('python01.wav', 'py*thon'); return false;"), ('class', 'audio_link'), ('target', '_blank')],
[('src', '/images/audio.gif'), ('alt', 'Listen to audio'), ('title', 'Listen to audio')],
[],
[('class', 'fl')],
[],
[('class', 'in')],
[('class', 'il')],
[('class', 'if')],
[],
[('class', 'def')],
[('class', 'gram')],
[],
]
Thank you for your help!
Perhaps not the greatest solution, but appears to do what you want:
I leave ‘optimizing’ this an exercise to you. If you could explain where this data is coming from and what sort of characteristics it has (can playAudio only be attached to things with an HREF attribute?), we could give you a better solution.
EDIT:
Personally for your specific example, I would do this: