[Tutor] ABout distinquishing elements in a string/regular expr

Xiao Yu Michael Yang x.yang3 at ugrad.unimelb.edu.au
Thu Sep 7 09:21:28 CEST 2006


Hi tutors,

   I am currently working on a project that identifies languages of html 
documents, using Python, of course. Just wondering, given a string:

   str = "<html> title this is french 77 992 / <aaabbbccc> </html>"
what is the python expression for:

1. r = return_anything_that's_within<> (str), i.e. it should give "html,
aaabbbccc, html"

2. r = remove_all_numbers(str), (what is the python expression for
'is_int') i.e. it removes "77" and "992"

3. dif = listA_minus_listB(str, r), i.e. should return ['77', '992'],
using the above 'r' value.

thank you for your time!



More information about the Tutor mailing list