Is
text.startswith(\'a\')
better than
text[0]==\'a\'
?
Knowing text is not empty and we a
Personally I would say startswith is more readable.
startswith
Also, from Python 2.5 startwith can take a tuple of prefixes to look for:
startwith
>>> "hello world".startswith(("hello","goodbye")) True