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

Popular posts from this blog

c++ - error: use of deleted function -

delphi - ESC/P programming! -

c# - how to write client side events functions for the combobox items -