[Tutor] query

invincible patriot invincible_patriot at hotmail.com
Sun Jan 31 23:09:46 CET 2010


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.kolev at gmail.com
> To: invincible_patriot at hotmail.com
> CC: anand.shashwat at gmail.com; david at pythontoo.com; tutor at 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 at 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.kolev at gmail.com>
> 
 		 	   		  
_________________________________________________________________
Hotmail: Free, trusted and rich email service.
http://clk.atdmt.com/GBL/go/196390708/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100131/e0687cd0/attachment.htm>


More information about the Tutor mailing list