В 22:09 +0000 на 31.01.2010 (нд), invincible patriot написа: > i just don wana index all the characters rather i wana double it too > like > ['d','a','v','i','d'] > would b > ['d','dd','a','aa','v','vv','i','ii','d','dd'] > and then i wana replace all non 'd' characters with '.' a dot > > i know how replace a specific character, but i don know how to replace > all characters other than a specific character > > > thanks > > > > > Subject: Re: [Tutor] query > > From: grigor.ko...@gmail.com > > To: invincible_patr...@hotmail.com > > CC: anand.shash...@gmail.com; da...@pythontoo.com; tutor@python.org > > Date: Sun, 31 Jan 2010 23:49:58 +0200 > > > > В 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> > > > > > ______________________________________________________________________ > Hotmail: Free, trusted and rich email service. Get it now. Read this http://docs.python.org/tutorial/controlflow.html#for-statements -- Grigor Kolev <grigor.ko...@gmail.com>
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor