Getting a unknown word out of a list with no spaces

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Thu Jul 17 04:15:58 EDT 2008


On Jul 17, 9:50 am, Alexnb:
> how can I test to see if  the first char of a string is "<"?

I suggest you to try the interactive shell:

>>> "hello"[0]
'h'
>>> "hello"[0] == "<"
False
>>> "hello"[0] == "h"
True
>>> "hello".startswith("h")
True

Bye,
bearophile



More information about the Python-list mailing list