Getting a unknown word out of a list with no spaces

Alexnb alexnbryan at gmail.com
Thu Jul 17 04:23:57 EDT 2008




bearophileHUGS wrote:
> 
> 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
> --
> http://mail.python.org/mailman/listinfo/python-list
> 
> 

really? That's just like C. I thought that it would fail because of the way
lists work. Thanks!

-- 
View this message in context: http://www.nabble.com/Getting-a-unknown-word-out-of-a-list-with-no-spaces-tp18502758p18503830.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list