Tom Anderson wrote: > On Sat, 26 Nov 2005, Chris wrote: > >> if item[0:1]=="-": > > item[0:1] seems a rather baroque way of writing item[0]! I'd actually > suggest writing this line like this:
Actually, it's not so much baroque as it is safe... item[0] will fail if the string is empty, while item[0:1] will return '' in that case. Of course, as you point out, .startswith() is the better approach anyway. -Peter -- http://mail.python.org/mailman/listinfo/python-list