[Tutor] Printing two elements in a list

Jacob S. keridee at jayco.net
Mon Dec 20 20:27:05 CET 2004


Duh, whack myself on the head a few times.
Thanks,
Jacob

> Max Noel wrote:
> > 
> > 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]
> >>
> > 
> >     A faster way to do this would be to use something like:
> > 
> > if thing.beginswith("Name"): del a[index]
> 
> Like, maybe,
>    if thing.startswith('Name')...
> 
> ;)
> 
> Kent
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> 


More information about the Tutor mailing list