В 21:21 +0000 на 31.01.2010 (нд), invincible patriot написа: > Hi > can any one tel me how can i do indexing of individual characters in > python > like if i hav a word eg david > a='david' > b=list(a) > # this will give ['d','a','v','i','d'] > not i want to print the index of each character > how can i do that > please tel me > > thanks > > > > ______________________________________________________________________ > Hotmail: Free, trusted and rich email service. Get it now. > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor List indexed by position ['d','a','v','i','d'] 0,1,2,3,4,5 Can index like this a[1] You can index and string too not need to be a list a[1] if you want find position of 'a' use this a.find('a') -- Grigor Kolev <grigor.ko...@gmail.com>
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor