[Tutor] Printing two elements in a list

Max Noel maxnoel_fr at yahoo.fr
Mon Dec 20 09:36:42 CET 2004


On Dec 19, 2004, at 06:16, Jacob S. wrote:

> Would this work for you?
>
> a = ['Name = stuff','CGTATAGCTAGCTA','Name = stuff','CGATATGCCGGCTA']
> for index,thing in enumerate(a):
>     if "Name=" in thing:
>         del a[index]
>
> I know, that it might be slow, but I thought that maybe it would hold 
> its
> own because it doesn't have to import the re module, everything's 
> builtin,
> etc.
>
> HTH,
> Jacob

	A faster way to do this would be to use something like:

if thing.beginswith("Name"): del a[index]

-- Max


-- 
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting 
and sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"



More information about the Tutor mailing list