mercredi 20 juillet 2016

how to get this results in python?

There are some strings:

String1='api/java/util/ArrayList.html#set'
String2='api/java/lang/NumberFormatException.html'

I expect following resutls with a regular expression.

For String1, Output should be a list:

 ['Array','List','set']

For String2, Output should be a list:

['Number','Format','Exception']

I try to implement, but failed, Any idea?

def getIsClue(InputString):
    p=re.compile(r'/(.*?).html')
    clueList=p.findall(InputString)
    print clueList
if __name__ == '__main__':
    getIsClue('api/java/lang/NumberFormatException.html')

Aucun commentaire:

Enregistrer un commentaire