Iterating over unicode strings

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


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