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

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -