Monday, April 15, 2013

Matching strings in python

use is or == but be careful about

empty spaces => ???
newlines  = > use rstrip()and lstrip()

An even better strategy from stackoverflow

s = s.strip(' \t\n\r')
This will strip any space, \t, \n, or \r characters from the left-hand side, right-hand side, or both sides of the string

to debug string matching always print with paddings 

    print "[DEBUG]: \nnew :"+reservation_new_time+"<"+"\nstd :"+reservation_stored+"<"+" cmp: "+ str(cmp(re\

No comments:

Post a Comment