Iterating over unicode strings

Arun Sharma arun-public at sharma-home.net
Sun Mar 10 23:33:07 EST 2002


Forgot to mention - using python 2.1

	-Arun

Arun Sharma wrote:
> 
> I would like to iterate over the following unicode string one character 
> at a time.
> 
> line = u"ಡಾ|| ಶಿವರಾಮ ಕಾರಂತ"
> for c in line:
>     print c
> 
> fails miserably. What is the right way to do it ? I would also like to 
> be able to slice the string i.e. line[i] to get the i'th character.
> 
> Thanks in advance,
> 
>     -Arun
> 





More information about the Python-list mailing list