python - Simple string match -
i want simple string match, searching -front- of string. there easier ways maybe builtin? (re
seems overkill)
def matchstr(ipadr = '10.20.30.40', matchip = '10.20.'): if ipadr[0:len(matchip)] == matchip: return true return false
def matchstr(ipadr = '10.20.30.40', matchip = '10.20.'): return ipadr.startswith(matchip)
Comments
Post a Comment